Install RSAT tools on Windows 1809 with SCCM

After installing Windows 10 1809 I needed to reinstall the RSAT tools as the tools are removed every time you upgrade to a newer version of Windows. A quick search of Microsoft’s site yielded nothing! It turns out that starting with 1809, Microsoft is no longer providing the RSAT tools as a separate download. The tools can now be added as an optional feature in the Settings app under Apps and Features.

Unlike previous versions of RSAT where all of the tools were installed as one package, it is now possible to add individual tools. There is however one drawback to installing RSAT using the Settings GUI. You have to install the tools one by one. There is no way to select multiple features at one time.

Using PowerShell to install RSAT tools

PowerShell gives you an easier way to install all of the tools at one time or add the tools one at a time.

Get-WindowsCapability -Online | ? Name -like *RSAT*

The command above displays the available RSAT tools, and you can add them using Add-WindowsCapability.
If you want to install all RSAT tools not yet installed, you can use the following command.

Get-WindowsCapability -Online |
? {$_.Name -like "*RSAT*" -and $_.State -eq "NotPresent"} |
Add-WindowsCapability -Online

 

Errors when using a WSUS Server

If you happen to be using your own WSUS server then chances are you will get an error trying to install RSAT via either the Settings app or when using the PowerShell command above.  The reason for this is that the RSAT tools are not included in the Windows 10 1809 installation media or via WSUS.  The tools still have to be downloaded from the internet but unlike previous versions, the tools are downloaded automatically by your machine instead of you downloading them manually from a website.

Currently, the RSAT tools do not seem to be available on WSUS so if you are using one locally you will see an error like the one below when attempting to install RSAT via PowerShell.  If you try via the Setting app the install will just stop after a short wait without any visible error.

 

Group Policy with the save

If you use WSUS you can allow your machine to get RSAT from Windows Update by modifying a setting in Group Policy. Create or edit the Group Policy of your choice and browse to Computer Configuration > Administrative Templates > System.  Now in the right windows click on “Specify settings for optional component installation and component repair“.

Enable this policy and select the checkbox Download repair content and optional features directly from Windows Update instead of WSUS.  Now run gpupdate /force and try to install RSAT again.  After updating the Group Policy option above the installation of RSAT should work.

Running the PowerShell command again should hopefully work and show output as in the picture below.

Installing RSAT with Configuration Manager

I have four different uses for the RSAT tools so I am going to create four different ways to install it with SCCM.

Method 1

For my first user, I only want to install Active Directory Users and Computers.

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File RSAT1809.ps1 ADUC

Method 2

For my second user, I am going to install the most common set of tools. (AD DS, DHCP, DNS, Group Policy Management, and Server Manager)

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File RSAT1809.ps1 Basic

Method 3

For the third user, I am just going to install ServerManager.

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File RSAT1809.ps1 Servermanager

Method 4

For the fourth user, I am going to install the entire RSAT suite of tools.

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File RSAT1809.ps1 All

Uninstall

To uninstall everything use the following.

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File RSAT1809.ps1 Uninstall

I was going to write my own powershell script but I came across these two great scripts by Martin Bengtsson over on Technet and Kevin Street so I used some of their code and added a bunch of my own  You can download Martin Bengtsson’s script at https://gallery.technet.microsoft.com/Install-RSAT-for-Windows-75f5f92f and Kevin Street’s here kevinstreet.co.uk.

You can verify the tools have been installed by looking under Administrative Tools on the start menu.

Configuration Manager
Create a SCCM application and choose “Manually specify the deployment type information”. Once you get to the part asking for install and uninstall information use the following.  Make sure to use the appropriate parameter (ADUC, All, Basic, or ServerManager). I used All in the example below.

 

Installation program: powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File RSAT1809.ps1 All

Uninstall program: powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File RSAT1809.ps1 Uninstall

I assume you already know how to create a deployment based on a script.  I may post some pictures later.

<#	
	.NOTES
	===========================================================================
	 Created with: 	SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.152
	 Created on:   	12/24/2018 12:49 PM
	 Created by:   	Wiz
	 Blog: 		    technology.wayneschoolswv.org/category/blog/
	 Filename:     	RSAT1809.ps1
     Made from code from scripts by the following two authors plus my own changes and improvements
     Author: Martin Bengtsson
     Blog: www.imab.dk
     Author: Kevin Street
     Blog: kevinstreet.co.uk
	===========================================================================
.SYNOPSIS
    Powershell script to install/uninstall RSAT (Remote Server Administration Tools) on Windows 10 v1809 and higher
   
.DESCRIPTION
    RSAT (Remote Server Administration Tools) in Windows 10 v1809 are no longer a downloadable add-on to Windows. Instead its included as a set of "Features on Demand" directly in Windows.
    The script must be ran as adminitrator or system.
    The script will only run on Windows 10 v1809 or higher.
    The script can be run from SCCM and has a registry key detection method for each type of install
    This script also applies fixes for the following error codes. Error code 0x800f0907, 0x800f0954, 0x8024500c
.EXAMPLES

    .\RSAT1809.ps1 All (Install all the RSAT features on the local PC)
    .\RSAT1809.ps1 ADUC (Installs AD on the local PC)
    .\RSAT1809.ps1 Basic (Installs AD, DHCP, DNS, GP Management and Server Manager on the local PC)
    .\RSAT1809.ps1 ServerManager (Installs Server Manager on the local PC)
    .\RSAT1809.ps1 Uninstall (Removes all RSAT features from the local PC)
#>

# Get command line parameter passed to script
$CLParameter = $args[0]


# Check for administrative rights
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
	
	Write-Warning -Message "This script requires Admin or System elevation to run!"
	break
	
}

# Set version and Registry Path
$CheckBuild = "17763"
$Windows = Get-WmiObject -Class Win32_OperatingSystem | Select-Object BuildNumber
$RegistryPath = "HKLM:\Software\RSAT1809"

# Check that we are on at least Windows 10 v1809
if ($Windows.BuildNumber -lt "$CheckBuild")
{
	
	Write-Error -Message "This script requires Windows 10 v1809 or higher!"
	break
	
}
# Continue if running on Windows 10 v1809+ and valid parameter passed
else
{
	# Assume WSUS is being used and make a registry change to allow RSAT to download from Windows Update
	# This fixes error 0x800f0907 and 0x8024500c some people are getting because they dont have access to the RSAT files to complete installation
	# We will restore original settings at the end of the script
	$rpss = (Get-ItemProperty -path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing').RepairContentServerSource > $null
	$rpss2 = (Get-ItemProperty -path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing').LocalSourcePath > $null
	$rpss3 = (Get-ItemProperty -path 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate').DoNotConnectToWindowsUpdateInternetLocations
	$rpss4 = (Get-ItemProperty -path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing').DoNotConnectToWindowsUpdateInternetLocations
	
	# Enable Optional Component updates via Microsoft Windows Updates to install RSAT tools in WSUS environment
	New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing' -Name RepairContentServerSource -Value "2" -PropertyType DWORD -Force -ErrorAction Continue > $null
	New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing' -Name LocalSourcePath -Value "" -Force -ErrorAction Continue  > $null
	If ((Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing').DoNotConnectToWindowsUpdateInternetLocations -eq $True) { Remove-ItemProperty -path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing -Name "DoNotConnectToWindowsUpdateInternetLocations" }
	If ((Get-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate').DoNotConnectToWindowsUpdateInternetLocations -eq $True) { Remove-ItemProperty -path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -Name "DoNotConnectToWindowsUpdateInternetLocations" }
	
	if ($CLParameter -eq "All")
	{
		
		# Query for RSAT features that are not already installed
		$Install = Get-WindowsCapability -Online | Where-Object { $_.Name -like "Rsat*" -AND $_.State -eq "NotPresent" }
		
		if ($Install -ne $null)
		{
			
			foreach ($Item in $Install)
			{
				
				try
				{
					Write-Host "Adding" $Item.Name
					Add-WindowsCapability -Online -Name $Item.Name
				}
				
				catch [System.Exception]
				{
					Write-Warning -Message $_.Exception.Message; break
				}
			}
			
			# Adding registry key for detection method in SCCM
			if (-NOT (Test-Path -Path $RegistryPath))
			{
				New-Item -Path $RegistryPath –Force > $null
			}
			
			New-ItemProperty -Path $RegistryPath -Name "1809RSATAll" -Value 1 -PropertyType "String" -Force > $null
			
		}
		
		else
		{
			Write-Host "RSAT is already fully installed!"
		}
	}
	if ($CLParameter -eq "ADUC")
	{
		
		# Query for RSAT features that are not already installed
		$Install = Get-WindowsCapability -Online | Where-Object { $_.Name -like "Rsat.ActiveDirectory*" -AND $_.State -eq "NotPresent" }
		
		if ($Install -ne $null)
		{
			
			foreach ($Item in $Install)
			{
				
				try
				{
					Write-Host "Adding" $Item.Name
					Add-WindowsCapability -Online -Name $Item.Name
				}
				
				catch [System.Exception]
				{
					Write-Warning -Message $_.Exception.Message; break
				}
			}
			
			# Adding registry key for detection method in SCCM
			if (-NOT (Test-Path -Path $RegistryPath))
			{
				New-Item -Path $RegistryPath –Force > $null
			}
			
			New-ItemProperty -Path $RegistryPath -Name "1809RSATADUC" -Value 1 -PropertyType "String" -Force > $null
			
		}
		
		else
		{
			Write-Host "RSAT is already fully installed!"
		}
	}
	if ($CLParameter -eq "Basic")
	{
		
		$Install = Get-WindowsCapability -Online | Where-Object { $_.Name -like "Rsat.ActiveDirectory*" -OR $_.Name -like "Rsat.DHCP.Tools*" -OR $_.Name -like "Rsat.Dns.Tools*" -OR $_.Name -like "Rsat.GroupPolicy*" -AND $_.State -eq "NotPresent" }
		
		if ($Install -ne $null)
		{
			
			foreach ($Item in $Install)
			{
				
				try
				{
					Write-Host "Adding" $Item.Name
					Add-WindowsCapability -Online -Name $Item.Name
				}
				
				catch [System.Exception]
				{
					Write-Warning -Message $_.Exception.Message; break
				}
			}
			
			# Adding registry key for SCCM to detect install
			if (-NOT (Test-Path -Path $RegistryPath))
			{
				New-Item -Path $RegistryPath –Force > $null
			}
			
			New-ItemProperty -Path $RegistryPath -Name "1809RSATBasic" -Value 1 -PropertyType "String" -Force > $null
			
		}
		
		else
		{
			$Install = (Get-WindowsCapability -Online | Where-Object { $_.Name -like "Rsat.ActiveDirectory*" }).Name
			Write-Host $Install "is installed already!"
		}
		
		
	}
	if ($CLParameter -eq "ServerManager")
	{
		
		$Install = Get-WindowsCapability -Online | Where-Object { $_.Name -like "Rsat.ServerManager*" -AND $_.State -eq "NotPresent" }
		
		if ($Install -ne $null)
		{
			
			try
			{
				Write-Host "Adding" $Install.Name ""
				Add-WindowsCapability -Online -Name $Install.Name
			}
			
			catch [System.Exception]
			{
				Write-Warning -Message $_.Exception.Message; break
			}
			
			if (-NOT (Test-Path -Path $RegistryPath))
			{
				New-Item -Path $RegistryPath –Force > $null
			}
			
			New-ItemProperty -Path $RegistryPath -Name "1809RSATServer" -Value 1 -PropertyType "String" -Force > $null
			
		}
		
		else
		{
			$Install = (Get-WindowsCapability -Online | Where-Object { $_.Name -like "Rsat.ServerManager*" }).Name
			Write-Host $Install "is installed already!"
		}
	}
	if ($CLParameter -eq "Uninstall")
	{
		Write-Host "Removing features ..." $Item.Name
		# Uninstall each RSAT component so that no dependancies are left behind
		
		try
		{
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.BitLocker.Recovery.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.CertificateServices.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.DHCP.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.Dns.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.FailoverCluster.Management.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.FileServices.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.IPAM.Client.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.LLDP.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.NetworkController.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.NetworkLoadBalancing.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.RemoteAccess.Management.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.RemoteDesktop.Services.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.Shielded.VM.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.StorageMigrationService.Management.Tools') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.StorageReplica.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.SystemInsights.Management.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.VolumeActivation.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.WSUS.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online }
			Get-WindowsCapability -Online | Where-Object { ($_.State -match 'Installed') -and ($_.Name -match 'Rsat.ServerManager.Tools~~~~0.0.1.0') } | %{ Remove-WindowsCapability -Name $_.Name -Online -OutVariable results }
			
		}
		
		catch [System.Exception]
		{
			Write-Warning -Message $_.Exception.Message; break
		}
		
		# Remove registry key used BY SCCM for detection method 
		
		if ((Test-Path $RegistryPath) -eq 'true') { Remove-Item -Path $RegistryPath -Force }
		else
		{
		}
		
	}
	else
	{
<#	
		# This script will fail if RestartNeeded=True is returned as the feature cannont be uninstalled until the machine is rebooted
		# Maybe return errorcode that reboot is required here? This section not tested yet.
		$RestartNeeded = (Invoke-WmiMethod -Namespace root\ccm\clientsdk -Class CCM_ClientUtilities -Name DetermineIfRebootPending).RebootPending
        if ($RestartNeeded -eq $true)
		{
			write-host "Restart Needed!!"
            [System.Environment]::Exit(3010)
		}
#>	}
	
	# Restore original services settings
	New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing' -Name RepairContentServerSource -Value $rpss -PropertyType DWORD -Force -ErrorAction Continue   > $null
	New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing' -Name LocalSourcePath -Value $rpss2 -Force -ErrorAction Continue   > $null
	If ($rpss3 -eq "1") { New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate' -Name DoNotConnectToWindowsUpdateInternetLocations -Value $rpss3 -PropertyType DWORD -Force -ErrorAction Continue > $null }
	If ($rpss4 -eq "1") { New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing' -Name DoNotConnectToWindowsUpdateInternetLocations -Value $rpss4 -PropertyType DWORD -Force -ErrorAction Continue > $null }
	
	Write-Host "Exiting as feature(s) already installed or no valid parameter passed!"
	
	#Write-Host $CLParameter;
}

 

This script creates different registry keys in HKLM\Software\RSAT1809 for you to use as detection methods. Each method creates its own key so if you have installed one feature such as “Servermanager” you would also be able to run the script again and install another set of features like “Basic”.  The uninstall method removes all features and all registry keys used for detection.

Error Messages

Error code = 0x800f0907

The above error is caused by the following GPO setting Specify settings for optional component installation and component repair under Computer/Administrative Templates/System. Make sure the setting Never attempt to download payload from Windows Update is set to Disabled (No CheckMark)

Error code = 0x800f0954

The above error is caused by the following GPO setting Specify settings for optional component installation and component repair under Computer/Administrative Templates/System. Make sure the setting Download repair content and option features directly from Windows Update instead of Windows Server Update Services (WSUS) is set to Enabled (CheckMark Selected)

Error code = 0x8024500c

If you enable the following policy you will end up with the above error.  Computer/Administrative Templates/Windows Updates/DoNotConnectToWindowsUpdateInternetLocations – Enabled

This setting shows up under the following registry setting.
HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing\DoNotConnectToWindowsUpdateInternetLocations – Enabled

About The Author

I have worked in the computer repair field since the early '90s. I was a technician and then Coordinator of Computer Repair for Regional Education Service Agency II (RESA 2) for 18 years. I currently work for Wayne County Schools as a Network Engineer/Technology Specialist. I am responsible for the schools' Internet access, Wi-Fi, networks, servers, laptops, desktops, and operating systems and software.

Related posts

3 Comments

  1. Jimmy

    The “Download repair content and optional features directly from Windows Update instead of WSUS” Group Policy fix does not work on 1909

    Reply
  2. Carl

    Jimmy, I disagree. At least in my case, flipping the GP setting has worked for me. Could there be other issues affecting yours?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

60 − = 57