Install RSAT Tools On Windows 11 Using PowerShell

A handy PowerShell script to install all RSAT tools, which seems more stable than other methods.

Published: 2024-12-19


Table of Contents


The Problem

I needed to install the RSAT tools on my PC to be able to view information about our Active Directory at work. Knowing how painful it is to do anything in the modern Settings app, I decided to have a crack at installing these through PowerShell.

Many sources online give you the below one-liner which should (in theory) install all of the tools for you.

Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online

This sounds really good, however running this often causes PowerShell to throw an exception and never actually finish the job. Sometimes I may be lucky, but more often than not, it doesn't work as you'd expect - even when running in an elevated prompt as an administrative user.

The Solution

So, I decided to have a play around in Powershell ISE, to try and get something to work. As it turns out, Powershell is reasonably easy to work with - feeling like a weird mix of Bash, Command Prompt and C#, with absolutely no regard to capitalisation.

After a bit of mucking around, I came up with the following script, which worked for me, first-time.

$tools = Get-WindowsCapability -Name RSAT* -Online | Select-Object -Property Name

foreach ($t in $tools)
{
    Write-Output $t
    Add-WindowsCapability -Online -Name $t
}

You can download and run this script if you need it, but you do so at your own risk.