Monthly Archives: June 2013

Install Windows Deployment Services Console

Windows Deployment Services (WDS) snap-in for Microsoft Management Console (MMC) that can be used to remotely configure a Windows Deployment Server is missing from Remote Server Administration Tools (RSAT) on Windows 7. Unfortunately this is not the only snap-in missing, and the following is the list of Roles/Services that are not supported by RSAT:

  • Server Manager
  • Active Directory Rights Management Services (AD RMS) Tools
  • Fax Service Manager
  • Network Policy and Access Services (NPS) Tools
  • Internet Storage Name Service
  • Storage Explorer
  • IIS 7 Manager (separate add-on)
  • Hyper-V Tools (separate add-on)
  • Windows Media Services (separate add-on)
  • WINS (Windows Internet Name Service)
  • Windows Server Backup

RSAT enables IT admins to remotely manage roles and features in Server from a client that is running Windows 7 OS, and the following PowerShell script will set up a WDS snap-in on a client machine for remote administration of WDS services.

This script has three mandatory parameters:

  1. WDSServer: Name a Windows 2008 Server which has the WDS Server Role installed (use 64-bit OS server for 64-bit OS client, and the same for 32-bit).
  2. Computer: Any client machine with preferably RSAT tools installed. You can type a name of one computer or specify the list of computers and pass a parameter   –Computer (Get-Content C:\Test\MyWDSclientList.txt).
  3. Link: Path to the shortcut (.lnk file). The best location for the shortcut on a client computer that has RSAT tools installed would be: %ProgramData%\Microsoft\Windows\Start Menu\Programs\Administrative Tools\WDS.lnk”. In my script I’ve just used the short one: “C:\Test\WDS.lnk”

The logic of the script could be summarized in the following four steps:

Step 1: Establish that Server has the WDS Server Role installed.

Step 2: Copy the following files from a Server to a Client’s corresponding folders:







Step 3: Register the following .dll files:

regsvr32 WdsMgmt.dll
regsvr32 WdsTptMgmt.dll
regsvr32 WdsMmc.dll

Step 4: Create a shortcut.

Run as Administrator your PowerShell CLI and type in (for example) the following:

Install-WDSconsole.ps1 -WDSServer Test-Dc-01 -Computer Test-AFL-05 -Link C:\Test\WDS.lnk

WDSNote that UserName\Password should be supplied for the account that has admin access to the WDS Server and client computers.

# Name: Install-WDSconsole.ps1
# Script installs WDS snap-in on remote machine.
# Author: Alex Dujakovic, June 05, 2013

<# .SYNOPSIS Script install WDS snap-in on remote computer and creates a shortcut for WDS snap-in .EXAMPLE Install-WDSconsole.ps1 -WDSServer Test-Dc-01 -Computer Test-AFL-05 -Link C:\Test\WDS.lnk #>




        If(Get-Service -ComputerName $WDSServer | Where {$_.Name -match "WDSServer"})
            {$serverIsWDSServer = $TRUE}
$Credential = Get-Credential
$UserName = $Credential.get_UserName()
$Password = $Credential.GetNetworkCredential().Password
$UNCPath = "\\$WDSserver\C$\Windows\System32"
$arrRegister = "WdsMgmt.dll","WdsTptMgmt.dll","WdsMmc.dll"
$Target = "C:\Windows\System32\WdsMgmt.msc"
# ************************************************************************************************

$ScriptWDSBlock = {
  param($UNC, $UserName, $Password, $arr, $TargetPath, $LinkPath)

# -----------------|Connecting to network share|----------------------------------
 C:\Windows\System32\net.exe use $UNC $Password /user:$($UserName) | Out-Null

# -----------------|Copy all files |----------------------------------------------
Copy-Item "$UNC\WdsMgmt.msc" "$env:SystemRoot\System32" -Force
Copy-Item "$UNC\en-US\WdsMgmt.msc" "$env:SystemRoot\System32\en-US" -Force

Copy-Item "$UNC\wdsmgmt.dll" "$env:SystemRoot\System32" -Force
Copy-Item "$UNC\en-US\wdsmgmt.dll.mui" "$env:SystemRoot\System32\en-US" -Force

Copy-Item "$UNC\WdsImage.dll" "$env:SystemRoot\System32" -Force
Copy-Item "$UNC\en-US\WdsImage.dll.mui" "$env:SystemRoot\System32\en-US" -Force

Copy-Item "$UNC\wdscsl.dll" "$env:SystemRoot\System32" -Force
#Copy-Item "$UNC\wdstptc.dll" "$env:SystemRoot\System32" -Force

Copy-Item "$UNC\WdsTptMgmt.dll" "$env:SystemRoot\System32" -Force
Copy-Item "$UNC\en-US\WdsTptMgmt.dll.mui" "$env:SystemRoot\System32\en-US" -Force

Copy-Item "$UNC\wdsmmc.dll" "$env:SystemRoot\System32" -Force
Copy-Item "$UNC\en-US\wdsmmc.dll.mui" "$env:SystemRoot\System32\en-US" -Force

# ------------------|Register .dll files |----------------------------------------
 foreach ($f in Get-ChildItem $TargetPath){
    if (Test-Path $f.fullname -include $arr)
			$r= $(regsvr32.exe /s $f.fullname )
            If($r -eq 0){Write-Host "$($env:ComputerName) File Registering SUCCEEDED: $f.fullname" -ForegroundColor Green}
            else { Write-Host "$($env:ComputerName) File Registering FAILED: $f.fullname" -ForegroundColor Red}

# -----------------| Create a shortcut |-------------------------------------------
function Create-ShortCut {
                [string]$WorkingDirectory="$(Split-Path $TargetPath -parent)",
                [string]$Description="$(Split-Path $TargetPath -Leaf)"
if(-not (Test-Path variable:\shortcut)) {$shortcut = New-Object -com "WScript.Shell"}
        # Pass the path to the shortcut, Example "D:\MyFile.lnk"
        $Link = $shortcut.CreateShortcut($LinkPath)
        $Link.TargetPath = $TargetPath
        # WorkingDirectory - Location of the working directory for the source app
        $Link.WorkingDirectory = $WorkingDirectory
        # Validate $WindowStyle for this shortcut
        $Link.WindowStyle = $WindowStyle
        # HotKey - hot key sequence to launch the shortcut, Example "CTRL+ALT+SHIFT+X"
        if($Hotkey.Length -gt 0 ) { $Link.HotKey = $Hotkey }
        # Arguments - Any additional parameters to pass to TargetPath
        if($Arguments.Length -gt 0 ) { $Link.Arguments = $Arguments }
        # Description - Description of the shortcut
        if($Description.Length -gt 0 ) { $Link.Description = $Description }
        # IconLocation - contains a fully qualified path and an index associated with the icon,
        # Example: "notepad.exe, 0";  //Zero is the index
        if($IconLocation.Length -gt 0 ) { $Link.IconLocation = $IconLocation }

Create-ShortCut $TargetPath $LinkPath $Arguments $WorkingDirectory $WindowStyle $IconLocation $Hotkey $Description
# End of scriptblock
       If($serverIsWDSServer) {
                $errorActionPreference = "Stop"
                $s = New-PSSession -ComputerName $computer -Authentication Credssp -Credential $Credential
                Invoke-Command -Session $s -ScriptBlock $ScriptWDSBlock `
                -ArgumentList $UNCPath, $UserName, $Password, $arrRegister, $Target, $Link
		         $s | Remove-PSSession

                  Write-Host "$_.Exception.Message"
		          Write-Host "$computer" -Separator ", -> " -foregroundcolor Yellow
        else { Write-Host "NOTE: $WDSServer does not have WDS Server Role Installed!" -ForegroundColor Red}
END {Write-Host "Script Finished  at $(Get-Date)" -ForegroundColor Green}

For this script to work correctly the following configuration settings must be set in GPO or manually:

  •     The Windows Remote Management service
  •     Windows Firewall exceptions
  •     Credential delegation (CresSSP)
  •     WinRM Client parameters
  •     WinRM Service parameters

The following post contains all information you need to set this through GPO:

Please note: Although the author has made every reasonable attempt to achieve complete accuracy of the content, he assumes no responsibility for errors or omissions. Also, you should use this information as you see fit, and at your own risk.