The 2011 Scripting Games Advanced Event 5: Use PowerShell to Determine Upgrade to Windows 7 Eligibility

The 2011 Scripting Games Advanced Event 5: Use PowerShell to Determine Upgrade to Windows 7 Eligibility

  • Comments 11
  • Likes

2011 Scripting Games badge

Summary: Advanced Event 5 of the 2011 Scripting Games uses Windows PowerShell to determine if a computer is upgradable to the Windows 7 operating system.

About this event

Division

Advanced

Date of Event

4/8/2011 12:15 AM

Due Date

4/15/2011 12:15 AM

Event scenario

Your company is planning an upgrade from Windows XP to Windows 7, and you get to write a script that will determine if a computer meets the requirements for the upgrade. Here are the requirements for the Windows 7 operating system:

  • 1 gigahertz (GHz) or faster 32-bit (x86) or 64-bit (x64) processor
  • 1 gigabyte (GB) RAM (32-bit) or 2 GB RAM (64-bit)
  • 16 GB available hard disk drive space (32-bit) or 20 GB (64-bit)
  • DirectX 9 graphics device with WDDM 1.0 or higher driver
Design points
  • Your solution should work on multiple computers.
  • Your solution should accept piped input for the computer names.
  • You should return a single object for each computer.
  • Your code should be reusable.
  • Your solution should have comment-based Help.
  • Your solution should use error handling.
  • Your solution should implement the –Debug switch.
  • Extra design points if your solution detects if the computer in question would be best upgraded to a 64-bit (x64) or to a32-bit (x86) Windows 7 operating system.

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
  • Can I assume these XP machines have powershell installed, and PSRemoting configured?  If so it enables a really powerful and elegant solution.  If not... well it's ugly but it works.

    ~Glenn

  • Stumped on "WDDM 1.0 or higher driver".  I've been searching but not finding a universal programmatic method to identifying WDDM version.  Obviously dxdiag reports it but where/how?

  • Ok, think I found my own answer (finally)...

    Intel Windows Aero Q/A: www.intel.com/.../cs-023607.htm

    To check if a WDDM driver is installed, find your graphics driver version number and look at the first number. If the first number is “7”, you are using a WDDM driver. If it is “6”, you are using an XPDM driver.

  • @Glenn yes you can assume "assume" the systems have PSRemoting configured ... you may want to add some sort of error checking to report you could not connect to a remote system ... or even test the remoting ... whatever you would "normally" do on your enterprise network. At a minimum some sort of logging would be called for because even on well maintained networks remote solutions seldom bat 1000.

    @Marcadamcarter I see you found "an" answer ... this scenario would be too easy if there was a Win32_WDDMVersion WMI class :-)

  • I read the game description again and again, and still can't see how we would know if a video device has a directx WDDM driver to meet the upgrade requirement. We can determine if the device is CURRENTLY running on a directX 9 w/ WDDM, but this is all about your current OS(assuming it's XP). Does it has anything to do with if Windows 7 is going to have a proper driver for the same device? Only when there is a proper *win7* driver(directX9+WDDM) for your video card then you can upgrade, correct? Or I got something wrong?

  • I am having trouble still with the WDDM piece.  I understand what marcadamcarter was saying about the version, but isn't that just specific to the Intel drivers?  (Ed's response is that it is *an* answer, which leads me to believe that it is not necessarily *THE* answer.)  I am almost finished with the core piece of this script (just needs some 'tarting,' as one competitor suggests [@tim_parkinson]) but still having trouble with this one piece.  In my reading, it sounds like XP can't use the WDDM driver, so if that is true, how could any of them have it?  I am all for finding the answer, and I may end up having to just enter my script without that component.  It's at least one star, and I am sure when the solution is opened, I will be enlightened.

  • @ DirectX with WDDM driver

    I do not expect you to be able to find IF Windows 7 will have a driver for the card. That is an interesting scenario, but was not in my mind when I wrote the scenario. I was specifically interested in you finding what the machine currently has and displaying that.

  • @Jonathan Tyler

    It is true that WDDM drivers were introduced for Windows Vista ... but Windows XP does have Direct X ... and you can detect that. In addition, you can use a Windows 7 computer to see if you can pick up the WDDM stuff ... afterwards. You can look at the drivers and see what they support, as well as what drivers the CARD might support ... there are many different ways to approach this scenario. To an extent, you define your own requirements, AND document that you are meeting them. Explain the logic and suppositions behind your decision.

  • @IamMred

    Thank you for further explaining.  Unfortunately, (and this is not a 'whine' but a statement of fact) all I have at my disposal are VMWare Workstation 5 instantiations of Windows 7.  To my knowledge, the SVGA II driver that is supplied with VMWare tools does not include the WDDM driver until VMWorkstation 7.  So, while I am able to run these scripts against Windows 7 instances, I am not able to validate the WDDM section or even be able to see where it might be located.  

    I will put that information in my comments for the notes and hope that the judges have a small amount of pity, but I also understand that you can't account for every possible situation the entrants would be in.

    While I have seen a lot of people complaining about the harshness of the scores, I am learning a great deal about Powershell that I never would have touched otherwise and improving my technique (I think).  I would love to see a "5" on a script and have come close on one so far, however, the benefit I am getting from the experience far outweighs the number of stars that show on the leaderboard.

    And, hey, there is always next year to get the perfect "5"'s! :)

  • @Jonathan Tyler I completely understand. I run a large number of machines on HyperV and unfortunately for some specific types of scripts I just need real hardware. This is especially true when working with certain types of bios, or drivers. Most of the time it does not make any difference, but every once in a while it does. I am glad you are learning, and are enjoying the 2011 Scripting Games.

  • thank you