Created
August 1, 2019 14:50
-
-
Save TScalzott/022a8ff4a0c2079a170db3f7f798e7f9 to your computer and use it in GitHub Desktop.
Use DISM to add any missing RSAT tools.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Install all missing Remote Server Administration Tools. | |
Windows 10 Feature Updates are reliably removing RSAT features. This script adds them back. | |
#> | |
$Caps = Dism.exe /ONLINE /GET-CAPABILITIES | |
$Caps | Select-String -Pattern ' : (Rsat\..*)' -Context 0, 1 | | |
ForEach-Object { | |
if ($_.Context.PostContext -match "Not Present") { | |
if ($_ -match ' : (Rsat\..*)') { | |
$command = "DISM.EXE /Online /Add-Capability /CapabilityName:$($matches[1])" | |
Write-Output "Invoking: $($command)" | |
Invoke-Expression $command | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment