Original script: https://gist.github.com/dually8/558fcfa9156f59504ab36615dfc4856a
We can check which, if any, RSAT tools are installed using PowerShell.
| Get-WindowsCapability -Name RSAT* -Online | Select-Object -Property Name, State
|
This script can be used to install RSAT in Windows 10 1809, 1903, and 1909. Installation instructions for other versions of Windows, as well as additional information about RSAT, can be found here. RSAT can be installed easily with PowerShell as well.
| <#
From https://gallery.technet.microsoft.com/Install-RSAT-for-Windows-75f5f92f
Usage: .\Install-RSATv1809v1903v1909.ps1 [-OPTION]
.\Install-RSATv1809v1903v1909.ps1 -All (-All is installing ALL the features within the RSAT bundle)
.\Install-RSATv1809v1903v1909.ps1 -Basic (-Basic is only installing AD DS, DHCP, DNS, Group Policy Management and Server Manager)
.\Install-RSATv1809v1903v1909.ps1 -ServerManager (-ServerManager is only installing the Server Manager)
.\Install-RSATv1809v1903v1909.ps1 -Uninstall (-Uninstall removes all RSAT features again)
.SYNOPSIS
Install RSAT features for Windows 10 1809 or 1903 or 1909.
.DESCRIPTION
Install RSAT features for Windows 10 1809 or 1903 or 1909. All features are installed online from Microsoft Update thus the script requires Internet access
.PARAM All
Installs all the features within RSAT. This takes several minutes, depending on your Internet connection
.PARAM Basic
Installs ADDS, DHCP, DNS, GPO, ServerManager
.PARAM ServerManager
Installs ServerManager
.PARAM Uninstall
Uninstalls all the RSAT features
.NOTES
Filename: Install-RSATv1809v1903v1909.ps1
Version: 1.2
Author: Martin Bengtsson
Blog: www.imab.dk
Twitter: @mwbengtsson
Version history:
1.0 - Script created
1.2 - Added test for pending reboots. If reboot is pending, RSAT features might not install successfully
Added test for configuration of local WSUS by Group Policy.
- If local WSUS is configured by Group Policy, history shows that additional settings might be needed for some environments
1.3 - Now using Get-CmiInstance instead of Get-WmiObject for determining OS buildnumber
#>
[CmdletBinding()]
param(
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[switch]$All,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[switch]$Basic,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[switch]$ServerManager,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[switch]$Uninstall
)
# Check for administrative rights
if (-NOT([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning -Message "The script requires elevation"
break
}
# Create Pending Reboot function for registry
function Test-PendingRebootRegistry {
$CBSRebootKey = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -ErrorAction Ignore
$WURebootKey = Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -ErrorAction Ignore
if (($CBSRebootKey -ne $null) -OR ($WURebootKey -ne $null)) {
$true
}
else {
$false
}
}
# Windows 10 1809 build
$1809Build = "17763"
# Windows 10 1903 build
$1903Build = "18362"
# Windows 10 1909 build
$1909Build = "18363"
# Get running Windows build
$WindowsBuild = (Get-CimInstance -Class Win32_OperatingSystem).BuildNumber
# Get information about local WSUS server
$WUServer = (Get-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name WUServer -ErrorAction Ignore).WUServer
#$DualScan = (Get-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name DisableDualScan -ErrorAction Ignore).DisableDualScan
$TestPendingRebootRegistry = Test-PendingRebootRegistry
if (($WindowsBuild -eq $1809Build) -OR ($WindowsBuild -eq $1903Build) -OR ($WindowsBuild -eq $1909Build)) {
Write-Verbose -Verbose "Running correct Windows 10 build number for installing RSAT with Features on Demand. Build number is: $WindowsBuild"
Write-Verbose -Verbose "***********************************************************"
if ($WUServer -ne $null) {
Write-Verbose -Verbose "A local WSUS server was found configured by group policy: $WUServer"
Write-Verbose -Verbose "You might need to configure additional setting by GPO if things are not working"
Write-Verbose -Verbose "The GPO of interest is following: Specify settings for optional component installation and component repair"
Write-Verbose -Verbose "Check ON: Download repair content and optional features directly from Windows Update..."
Write-Verbose -Verbose "***********************************************************"
}
if ($TestPendingRebootRegistry -eq "True") {
Write-Verbose -Verbose "Reboots are pending. The script will continue, but RSAT might not install successfully"
Write-Verbose -Verbose "***********************************************************"
}
if ($PSBoundParameters["All"]) {
Write-Verbose -Verbose "Script is running with -All parameter. Installing all available RSAT features"
$Install = Get-WindowsCapability -Online | Where-Object {$_.Name -like "Rsat*" -AND $_.State -eq "NotPresent"}
if ($Install -ne $null) {
foreach ($Item in $Install) {
$RsatItem = $Item.Name
Write-Verbose -Verbose "Adding $RsatItem to Windows"
try {
Add-WindowsCapability -Online -Name $RsatItem
}
catch [System.Exception]
{
Write-Verbose -Verbose "Failed to add $RsatItem to Windows"
Write-Warning -Message $_.Exception.Message
}
}
}
else {
Write-Verbose -Verbose "All RSAT features seems to be installed already"
}
}
if ($PSBoundParameters["Basic"]) {
Write-Verbose -Verbose "Script is running with -Basic parameter. Installing basic RSAT features"
# Querying for what I see as the basic features of RSAT. Modify this if you think something is missing. :-)
$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*" -OR $_.Name -like "Rsat.ServerManager*" -AND $_.State -eq "NotPresent" }
if ($Install -ne $null) {
foreach ($Item in $Install) {
$RsatItem = $Item.Name
Write-Verbose -Verbose "Adding $RsatItem to Windows"
try {
Add-WindowsCapability -Online -Name $RsatItem
}
catch [System.Exception]
{
Write-Verbose -Verbose "Failed to add $RsatItem to Windows"
Write-Warning -Message $_.Exception.Message
}
}
}
else {
Write-Verbose -Verbose "The basic features of RSAT seems to be installed already"
}
}
if ($PSBoundParameters["ServerManager"]) {
Write-Verbose -Verbose "Script is running with -ServerManager parameter. Installing Server Manager RSAT feature"
$Install = Get-WindowsCapability -Online | Where-Object {$_.Name -like "Rsat.ServerManager*" -AND $_.State -eq "NotPresent"}
if ($Install -ne $null) {
$RsatItem = $Install.Name
Write-Verbose -Verbose "Adding $RsatItem to Windows"
try {
Add-WindowsCapability -Online -Name $RsatItem
}
catch [System.Exception]
{
Write-Verbose -Verbose "Failed to add $RsatItem to Windows"
Write-Warning -Message $_.Exception.Message ; break
}
}
else {
Write-Verbose -Verbose "$RsatItem seems to be installed already"
}
}
if ($PSBoundParameters["Uninstall"]) {
Write-Verbose -Verbose "Script is running with -Uninstall parameter. Uninstalling all RSAT features"
# Querying for installed RSAT features first time
$Installed = Get-WindowsCapability -Online | Where-Object {$_.Name -like "Rsat*" -AND $_.State -eq "Installed" -AND $_.Name -notlike "Rsat.ServerManager*" -AND $_.Name -notlike "Rsat.GroupPolicy*" -AND $_.Name -notlike "Rsat.ActiveDirectory*"}
if ($Installed -ne $null) {
Write-Verbose -Verbose "Uninstalling the first round of RSAT features"
# Uninstalling first round of RSAT features - some features seems to be locked until others are uninstalled first
foreach ($Item in $Installed) {
$RsatItem = $Item.Name
Write-Verbose -Verbose "Uninstalling $RsatItem from Windows"
try {
Remove-WindowsCapability -Name $RsatItem -Online
}
catch [System.Exception]
{
Write-Verbose -Verbose "Failed to uninstall $RsatItem from Windows"
Write-Warning -Message $_.Exception.Message
}
}
}
# Querying for installed RSAT features second time
$Installed = Get-WindowsCapability -Online | Where-Object {$_.Name -like "Rsat*" -AND $_.State -eq "Installed"}
if ($Installed -ne $null) {
Write-Verbose -Verbose "Uninstalling the second round of RSAT features"
# Uninstalling second round of RSAT features
foreach ($Item in $Installed) {
$RsatItem = $Item.Name
Write-Verbose -Verbose "Uninstalling $RsatItem from Windows"
try {
Remove-WindowsCapability -Name $RsatItem -Online
}
catch [System.Exception]
{
Write-Verbose -Verbose "Failed to remove $RsatItem from Windows"
Write-Warning -Message $_.Exception.Message
}
}
}
else {
Write-Verbose -Verbose "All RSAT features seems to be uninstalled already"
}
}
}
else {
Write-Warning -Message "Not running correct Windows 10 build: $WindowsBuild"
}
|
Last update: 2026-10-12
Created: October 12, 2026 19:04:17