Download And Install Remote Server Administration Tools for Windows 10 On Windows 10 Creators Edition Using PowerShell

#Download And Install Remote Server Administration Tools for Windows 10 On Windows 10 Creators Edition Using PowerShell

#Just the code to install Remote Server Administration Tools x64

$MSUPath = 'c:\RSAT' #Set temp path
New-Item -ItemType Directory -Path $MSUPath -Verbose #Create temp folder
Start-BitsTransfer -Source 'https://download.microsoft.com/download/1/D/8/1D8B5022-5477-4B9A-8104-6A71FF9D98AB/WindowsTH-RSAT_WS2016-x64.msu' -Destination $MSUPath\WindowsTH-RSAT_WS2016-x64.msu -Verbose #Download 64-bit RSAT tools
$ExpandOpt='-f:* "'+$MSUPath+'\WindowsTH-RSAT_WS2016-x64.msu" '+$MSUPath #Create argument list for expand.exe
$DismOpt="/Online /Add-Package /PackagePath:$MSUPath\WindowsTH-KB2693643-x64.cab" #Set dism.exe argument options
Start-Process -FilePath expand.exe -ArgumentList $ExpandOpt -PassThru -Wait #Expand RSAT installation files
Start-Process -FilePath dism.exe -ArgumentList $DismOpt -PassThru -Wait #Run dism with argument options. Takes a few minutes to install.

#Use the next command with care if you changed the temporary folder from c:\RSAT to something else

Remove-Item -Path $MSUPath -Recurse -Verbose

#The Longer Story…

#This was a real pain in the ass. .MSU files are not ideal to deal with in PowerShell and far different from .MSI installs. It is possible that Remote Server Administration Tools for Windows 10 can’t be installed remotely using wusa.exe. There are security issues with wusa.exe and Windows 10 for sure. The wusa.exe /extract option doesn’t work in Windows 10 either, due to the same security concerns.

#Set temporary path for installation

#Set this to whatever path you want. I prefer to use a empty new folder but any temporary folder will do. Watch out for the Remove-Item command later on though if you use an existing folder for your download location.

$MSUPath = 'c:\RSAT' #Set temp path
$MSUPath = 'c:\RSAT'
$MSUPath = ‘c:\RSAT’

#Create temporary folder

#Create the folder c:\RSAT or as set in the previous command. Skip this step if you plan to use an existing folder.

New-Item -ItemType Directory -Path $MSUPath -Verbose #Create temp folder
New-Item -ItemType Directory -Path $MSUPath -Verbose
New-Item -ItemType Directory -Path $MSUPath -Verbose

#Download 64-bit version of Remote Server Administration Tools for Windows 10

#I am dealing with the 64-bit version only. I don’t know why you would even have a 32-bit version of Windows 10 Creators Edition but I’m guessing there are people doing it. You need to figure out the link yourself or download the RSAT package some other way. This command only works in PowerShell and PowerShell Remote but not in PowerShell Direct since it uses BITS.

#Download Page: https://www.microsoft.com/en-us/download/details.aspx?id=45520

Start-BitsTransfer -Source 'https://download.microsoft.com/download/1/D/8/1D8B5022-5477-4B9A-8104-6A71FF9D98AB/WindowsTH-RSAT_WS2016-x64.msu' -Destination $MSUPath\WindowsTH-RSAT_WS2016-x64.msu -Verbose #Download 64-bit RSAT tools for Win10
Start-BitsTransfer -Source 'https://download.microsoft.com/download/1/D/8/1D8B5022-5477-4B9A-8104-6A71FF9D98AB/WindowsTH-RSAT_WS2016-x64.msu' -Destination $MSUPath\WindowsTH-RSAT_WS2016-x64.msu -Verbose
Start-BitsTransfer -Source ‘https://download.microsoft.com/download/1/D/8/1D8B5022-5477-4B9A-8104-6A71FF9D98AB/WindowsTH-RSAT_WS2016-x64.msu’ -Destination $MSUPath\WindowsTH-RSAT_WS2016-x64.msu -Verbose

#Set expand.exe options

#wusa.exe /extract does not work in Windows 10 so expand.exe must be used. These are the -ArgumentList options I had to set using a variable due to the really appalling quote and double quote bullshit that needs to happen to get some of these commands to work. I do not recommend trying to use the wusa.exe method of installing Remote Server Administration Tools for Windows 10 if even just to be stubborn as wusa.exe is just not designed to work properly when installing .MSU files via PowerShell in Windows 10.

$ExpandOpt='-f:* "'+$MSUPath+'\WindowsTH-RSAT_WS2016-x64.msu" '+$MSUPath #Create argument list for expand.exe
$ExpandOpt='-f:* "'+$MSUPath+'\WindowsTH-RSAT_WS2016-x64.msu" '+$MSUPath
$ExpandOpt=’-f:* “‘+$MSUPath+’\WindowsTH-RSAT_WS2016-x64.msu” ‘+$MSUPath

#Set options for Dism.exe

#Set -ArgumentList for Start-Process to launch the dism.exe command. Using dism.exe is just another crutch to get Remote Server Administration Tools for Windows 10 installed remotely using PowerShell Remote. There is not an equivalent native PowerShell command to replace dism.exe yet.

$DismOpt="/Online /Add-Package /PackagePath:$MSUPath\WindowsTH-KB2693643-x64.cab" #Set dism.exe argument options
$DismOpt="/Online /Add-Package /PackagePath:$MSUPath\WindowsTH-KB2693643-x64.cab"
$DismOpt=”/Online /Add-Package /PackagePath:$MSUPath\WindowsTH-KB2693643-x64.cab”

#Expand the .MSU file using expand.exe

#As I already mentioned… WUSA.exe – Extract option is gone in Windows 10

Start-Process -FilePath expand.exe -ArgumentList $ExpandOpt -PassThru -Wait #Expand RSAT installation files
Start-Process -FilePath expand.exe -ArgumentList $ExpandOpt -PassThru -Wait
Start-Process -FilePath expand.exe -ArgumentList $ExpandOpt -PassThru -Wait

#Install RSAT .CAB file using dism.exe

#Dism.exe is what actually works and is the method I recommend but it is slow. Takes about 5 minutes to install with my setup. You will have to wait. I have had varying degrees of success using pkgmgr.exe to install also but also I get a message in certain instances that pkgmgr.exe is depreciated so I have stayed away from using that method to install RSAT.

Start-Process -FilePath dism.exe -ArgumentList $DismOpt -PassThru -Wait #Run dism with argument options. Takes a few minutes to install.
Start-Process -FilePath dism.exe -ArgumentList $DismOpt -PassThru -Wait
Start-Process -FilePath dism.exe -ArgumentList $DismOpt -PassThru -Wait

#Remove c:\RSAT once install of WindowsTH-RSAT_WS2016-x64.msu has completed

#If you changed $MSUPath then pay attention here. You don’t want to delete a folder with other data in it. The RSAT install files are no longer needed though and can be safely deleted.

Remove-Item -Path $MSUPath -Recurse -Verbose
Remove-Item -Path $MSUPath -Recurse -Verbose
Remove-Item -Path $MSUPath -Recurse -Verbose

#You do not have to do anything else but here is the command to verify what features are currently installed.

#All Remote Server Administration Tool features are installed and enabled by default. Also you no longer need dism.exe to manage the RSAT package features. Instead Enable-WindowsOptionalFeature and Disable-WindowsOptionalFeature should be used at this point. The command below should get you started if you need to tweak available installed features. The list is too long to screen shot all at once so a snip is not included.

Get-WindowsOptionalFeature -Online -FeatureName *RSAT*|ft -a

#The Remote Server Administration Tools icons are there under Control Panel and then Administrative Tools.

#The image below shows what the default installation should look like in Windows 10.