Windows Deployment Services and the Get-WdsDriverPackage Cmdlet


I made the fatal mistake of importing 133 driver packages into a Windows Server 2012 Instance of Windows Deployment Services without adding them to a driver group. Needless to say, when I imaged a machine using WDS dependent on some of those drivers, they were not automatically installed.

I wanted to save myself the arduous activity of manually adding each driver package to a driver group. My first thought was PowerShell and it's suite of Windows Deployment Services cmdlets. It wasn't long however, until I found a problem:

PS C:\Windows\system32> (Get-WdsDriverPackage | Measure-Object).Count

The Get-WdsDriverPackage, which according Microsoft's documentation when not supplied with a name or ID, should list all the WDS driver packages. Thus, the result above is 130 driver packages short. I confirmed this with wdsutil:

PS C:\Windows\system32> ((wdsutil /get-alldriverpackages | Select-String "^Id:") | Measure-Object).Count

I did some more digging and I could retrieve any driver package in the store by it's name, regardless of whether or not it was included in the 3 driver packages returned when using Get-WdsDriverPackage without any parameters. Odd. Needless to say, with a little more effort, I was able to add all driver packages to the default driver group:

PS C:\Windows\system32> ((wdsutil /get-alldriverpackages | Select-String "^Id:") -replace "}","{") | %{ $_.split("{")[1] } | %{
    Add-WdsDriverPackage -id $_ -GroupName "DriverGroup1"

It seems a shame that although there's finally away to interact with WDS using PowerShell, that the Get-WdsDriverPackage cmdlet doesn't work as I expected. If anyone can enlighten me as to why this is, I'd love to know! I will of course update this article with any useful feedback with full credit to the contributor.