<# .SYNOPSIS Installs the complete Remote Server Administration Tools (RSAT) suite on Windows 10/11. .DESCRIPTION Automates the discovery and installation of all available Remote Server Administration Tools (RSAT) Windows Capabilities on Windows 10 (1809+) and Windows 11. The script queries all RSAT features available on demand via Windows Update/WSUS, identifies those not currently enabled, and sequentially provisions every missing administration tool. .EXAMPLE irm https://gist.githubusercontent.com/raw/YOUR_GIST_ID/install-rsat.ps1 | iex irm https://1qaz.ca/install-rsat | iex Downloads and executes the full RSAT setup remotely via an elevated PowerShell session. .EXAMPLE .\install-rsat.ps1 Executes the script locally from an elevated PowerShell session. .NOTES Prerequisites: - Must run in an Elevated PowerShell Session (Run as Administrator). - Requires Windows 10 Pro/Enterprise/Education (1809+) or Windows 11 Pro/Enterprise/Education. - Requires active internet connectivity or local access to Features on Demand (FOD). Key Features: - Idempotent Execution: Scans existing system capabilities and skips tools already installed. - Full Suite Provisioning: Targets all RSAT components (AD DS, DNS, DHCP, Group Policy, Server Manager, WSUS, etc.). - Granular Tracking: Provides real-time progress for each capability installation. .LINK https://learn.microsoft.com/en-us/windows-server/administration/install-remote-server-administration-tools #> # Requires Elevated PowerShell Session if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { throw "This script must be executed in a PowerShell session running as Administrator." } $ErrorActionPreference = 'Stop' Write-Host "Querying available RSAT capabilities..." -ForegroundColor Cyan $rsatCapabilities = Get-WindowsCapability -Name "Rsat*" -Online $missingCapabilities = $rsatCapabilities | Where-Object State -ne 'Installed' $installedCount = ($rsatCapabilities | Where-Object State -eq 'Installed').Count $missingCount = $missingCapabilities.Count Write-Host "Found $($rsatCapabilities.Count) total RSAT capabilities ($installedCount already installed, $missingCount missing)." -ForegroundColor Yellow if ($missingCount -eq 0) { Write-Host "All RSAT tools are already installed on this machine." -ForegroundColor Green return } Write-Host "Beginning installation of $missingCount missing RSAT tool(s)...`n" -ForegroundColor Cyan foreach ($tool in $missingCapabilities) { # Parse readable module name from package ID $displayName = $tool.Name.Split("~")[0].Replace("Rsat.", "").Replace(".Tools", "") Write-Host "Installing: $displayName ($($tool.Name))..." -ForegroundColor Cyan try { Add-WindowsCapability -Online -Name $tool.Name | Out-Null Write-Host "Successfully installed $displayName." -ForegroundColor Green } catch { Write-Host "Failed to install ${displayName}: $_" -ForegroundColor Red } } Write-Host "`nFull RSAT installation process complete!" -ForegroundColor Green