The 2011 Scripting Games Beginner Event 1: Use PowerShell to Identify Private Builds of Software

The 2011 Scripting Games Beginner Event 1: Use PowerShell to Identify Private Builds of Software

  • Comments 19
  • Likes

2011 Scripting Games badge

Summary: Beginner Event 1 of the 2011 Scripting Games uses Windows PowerShell to identify private or public builds of software.

About this event

Division

Beginner

Date of Event

4/4/2011 12:01 AM

Due Date

4/11/2011 12:01 AM

Event scenario

You are the network administrator for a large multinational company with a Premier Services Contract with the Microsoft Corporation. Because of your contract, you have received a private build of a specific application that has a compatibility issue with your custom application. In preparation for your server upgrade to Service Pack 1 for Windows Server 2008 R2, your boss has asked you to identify which servers are running this private build of the application. For the purposes of this scenario, you can use the notepad.exe process. You should report the computer name, the process name (Notepad) and whether or not Notepad is a private build. You must report the actual computer name and not something generic like “localhost” because this will facilitate logging later.

The minimum requirement is code to determine if Notepad is a private build or not. Additional information in the output is not acceptable due to logging requirements. An acceptable output is shown here.

Image of command output

Design points
  • Extra points for the ability to scan more than one computer
  • Extra points for the ability to scan for programs other than Notepad
  • Extra points for reusable code

2011 Scripting Games links

2011 Scripting Games: All Links on One Page

Submit your scripts on PoshCode

Support our Sponsors!

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.

Ed Wilson, Microsoft Scripting Guy

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • <p>Not sure what you mean by a &quot;private build&quot;. &nbsp;Specific version of the exe? &nbsp;Specific company provided it? &nbsp;Can you explain better without giving the solution away?</p>

  • <p>@GRebel a private build is a build of a software application that is made and not distributed to the public. It could be made for a specific customer, or it could be made and kept internal. There is a property that you can find that will tell you if the process is a private build or not. </p>

  • <p>What a whip! I hope they don&#39;t get too much harder, this one took me a good 6 hours cook up : P</p>

  • <p>What a whip! I hope they don&#39;t get too much harder, this one took me a good 6 hours cook up : P</p>

  • <p>@Gabe Rosas I do not think they will be much harder than this one. In fact, I know that several are actually easier than this one. Six hours? Great commitment! I am impressed! </p>

  • <p>While I managed to do this on my local computer I have not found a solution to scan over the network. At least the most obvious way does not work for this property. And I think that some other ways are probably too complicated for a &quot;beginner&quot; task (e.g. as they need PS and specific configuration on the remote system).</p> <p>Could you please confirm that there is a (simple) solution for this? Thank you.</p>

  • <p>Started it Monday after lunch; just got done with it today. &nbsp;The &quot;Windows PowerShell 2 For Dummies&quot; book apparently did not have me in mind.</p>

  • <p>after uploading I caught a typo from me having multiple versions while working on it. &nbsp;I put the correction in the comment field since I got the &quot;can only upload 1 script per event&quot; error.</p>

  • <p>Had a bear of a time getting the private build information from a remote server. Can&#39;t wait to see a more official version of this script. Mine works, but didn&#39;t take the time to run against sets or processes/computers. That would have made me feel better. However, at least it&#39;s finally submitted and I can expect at least 1 star for the submission. :-)</p> <p>I agree with you, Gabe. If these get much harder, I think I&#39;ll be approaching the &quot;throw in the towel&quot; phase. I&#39;m definitely more of a DB guy than a script monkey.</p> <p>@Martin - there are ways of getting it to work over the network, though it definitely took me a while to find it. May want to check WMI possibilities. I cannot confirm that there&#39;s a simple solution to it, though. I&#39;m guessing some of the people playing this as &quot;golf&quot; (write a script with as few lines as possible) probably have a one-liner, but I know that was not me.</p>

  • <p>@Peter</p> <p>You&#39;re probably like me, se we&#39;re just stressin&#39; aiming to get the design points : -] </p> <p>I very much love this setup though - you can complete about 80% of the functionality with just light research if you&#39;re like me (green at PS). Thanks to the upcoming weekend I will definitely see this thing through.</p>

  • <p> know I am making it MUCH more complicated than it needs to be. The beauty pw PS is that very little with do a lot. I tend to get really inviolved and have it check this and that. My problem was getting all three of the pieces from the get-process. I can find bits and pieces elsewhere. I&#39;d hat to see what the advanced game is lke!!!</p> <p>I several times came close to throwing in the towel. But I figure my scripts may be a lot bulkier than they need to be and i am doing more than what is required BUT I am learning more and more and thats all that matter right. well and if I can pick up a copy of primalscript i&#39;d be happy. Or maybe ed shouod give us all in the beginner events a signed copy of his book!? LOL</p>

  • <p>For some reason, I can&#39;t for the life of me find out how to tell if an application is private build or not. I can find the build information, which shows me some numbers, but nothing that shows a true/false sort of thing. Grrrr</p>

  • <p>I&#39;m glad I&#39;m not the only one who has/has some issues with this one. Maybe I will not quits just yet. :-)</p>

  • <p>@socaldavis</p> <p>Maybe this will help: Get-Process -name Notepad | % { $_.Modules | % { $_.FileVersionInfo | fl * }}</p>

  • <p>@marcadamcarter omg thank you so much, not sure I would have ever figured that one out!!!!</p>