Using PowerShell to manage WDS in Windows Server 2012 R2

In Windows Server 2012 R2 Microsoft finally added in PowerShell support for Windows Deployment Services.

The official TechNet documentation that you find here, is not entirely correct though: The module is not named WindowsDeploymentServices as the TechNet documentation states, but instead WDS.

Note: The cmdlets only works if you execute them locally on the WDS server, adding WDS Tools on another server won't help. To get the WDS cmdlets to work remotely, you can use Invoke-Command with CredSSP. Check Brad Rutkowski's blog for a nice article on configuring CredSSP.

Anyway, to list all available cmdlets, simply run: Get-Command -Module WDS

If you want to count the numbers (out of curiosity), simply add .Count, and put the command inside (), like this:
(Get-Command -Module WDS).Count

image
Counting the WDS cmdlets in Windows Server 2012 R2.

image
Listing the available cmdlets for WDS in Windows Server 2012 R2.

Adding boot images

As an example, here is how to add a MDT 2013 boot image to WDS.

Import-WdsBootImage -Path D:\MDTProduction\Boot\LiteTouchPE_x64.wim -NewImageName "MDT Production x64" -SkipVerify

Note: When testing on a clean install of WDS, I had to close and reopen the WDS console for the boot image to appear. Refreshing the Boot Images was not enough.

image
Adding boot images via PowerShell.

image
The WDS Console after adding a boot image via PowerShell (and reopen the console).

Prestaging a client

Here is a sample to prestage a machine based on Mac Address:

New-WdsClient -DeviceID "00155D000087" -DeviceName "PC0087" -BootImagePath "Boot\x64\Images\LiteTouchPE_x64.wim"

image
Prestaging a device.

Controlling PXE policy per device

You can also add the -PxePromptPolicy OptIn option to control the PXE prompt policy.

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

>