Mouse and keyboard not detected by Windows 7 setup

We recently got a batch of new workstations on campus that are using USB3 for half of the supplied USB ports. We had some problems during the WDS setup of these as there is no native support for USB3 in WinPE 3.0 as supplied with Windows 7 Service Pack 1, and of course our WDS boot menus use WinPE 3.0.

After hitting F12 to initiate the WDS setup WinPE happily loaded but obviously offered no mouse or keyboard support when using the USB3 ports. Okay, you could swap mouse and keyboard to USB2 and this would immediately resolve the issue. However, best to get the USB3 drivers into PE. I did this using the driver injection method as blogged about previously: WDS How To – deploy drivers See the section titled: “Boot image driver injection has become very easy!” (WDS dynamic driver management is excellent, I may have mentioned that before… )

For those of you who don’t know, USB3 ports are coloured blue on the inside, so you can easily spot them if they’re there:

usb3 image

Pre-staging Computers in Active Directory for WDS with PowerShell and Quest AD cmdlets

One of the most common issues when buidling computers with Windows Deployment Services (WDS, and RIS before that) are typos in the GUIDs used to net-boot the PCs. When you’re entering them by hand as you pre-stage the computer objects in Active Directory it’s very easy to make mistakes, especially when you’re entering a lot of them. It’s also extremely time consuming if you have to boot each machine to the point of PXE displaying the MAC and GUID – that’s why the smart move is to request that information from the supplier, preferably before they deliver the machines.

Anyone who has pre-staged a computer object before will be aware of the jiggery-pokery that goes on with switching round the first half of the GUID, so that when you view it later in ADUC, you see something significantly different to what you typed in. It appear that this conversion is done by the GUI when you create the object, so when you’re adding them programatically, you need to change the format yourself.

Microsoft published a VBScript function to reformat the GUIDs so they could be added to AD by a script, but I haven’t seen similar in PowerShell, so here it is:

function flip-guid ([string]$g) {
$g = $g.replace("-","").replace(" ","")
-join $g.substring(0,16).tochararray()[6,7,4,5,2,3,0,1,10,11,8,9,14,15,12,13] + $g.substring(16,16)

The function takes the GUID as a string and first removes any dashes or spaces (since I’ve received them from suppliers with both at different times). Next it converts the first half into an array of characters, selects them back in the new order and uses the join operator to make them back into a string, to which it concatenates the second half, unchanged from the original. As with most things in PowerShell it could be reduced down to a single line, or expanded further to enhance readability.

So, given the ability now to change the format, I use Quest’s AD cmdlets (if you haven’t come across these before, take a look now!) to create the computer objects. Assuming that you have a CSV file containing the new PC’s name and GUID, just do this…

Import-Csv newpcs.csv | foreach {
New-QADComputer $ -ParentContainer "SomeOU" -ObjectAttributes @{netbootguid = ([guid](flip-guid $_.guid)).ToByteArray()}

That’ll leave you with a load of new computer objects ready for WDS. 🙂

NB. It’s likely that the code snippets above have been wrapped to fit the page layout. In the function there are only two lines – everything from “-join” to the end is the same line. In the foreach scriptblock that’s just a single line.

Free PowerShell eBooks

Windows PowerShell is slowly taking over the world in terms of automation and administration of Microsoft products and beyond. For many Windows IT pros who are used to working with GUI interfaces there can be quite a learning curve, but thankfully the PowerShell community is producing some really great resources to help people learn and use PowerShell, including a collection of free eBooks. Jason Hofferle has helpfully compiled them into a single blog post: List of Free PowerShell eBooks

These books are authored by some of the brightest and best names in PowerShell, so I can’t recommend them highly enough.