Remote Server Administration Tools (RSAT) are tools available on both servers and client systems to manage server services. RSAT tools are available in Windows desktop and server versions. Most of the RSAT tools are not installed by default but are easily added.
RSAT includes GUI tools, like Microsoft Management Console (MMC) and MMC snap-ins (for example the DNS or DHCP MMC snap-ins) as well as command-line tools and additional PowerShell modules. You have the option of installing the Windows feature including the tools (most useful on a server), or just the tools to manage the feature (most useful on a workstation).
The recipe that follows is run from DC1
, a Windows Server 2016 with Desktop Experience installation. If you try to use Server Core for this recipe, note that Out-GridView
, for example in step 3
, is not available in the Server Core version, as it lacks the graphical user interface. For Server Core installations, use Format-Table
instead.)
- You use the
Get-Command
, andTee-Object
cmdlets to retrieve both the collection of PowerShell commands and the number of cmdlets intoPowerShellvariables
before installing the RSAT:
$CountOfCommandsBeforeRSAT = Get-Command | Tee-Object -Variable 'CommandsBeforeRSAT' | Measure-Object '{0} commands' -f $CountOfCommandsBeforeRSAT.count
- Examine the objects returned by
Get-Command
:
$CommandsBeforeRSAT |Get-Member | Select-Object -ExpandProperty TypeName -Unique
- View commands in
Out-GridView
:
$CommandsBeforeRSAT | Select-Object -Property Name, Source, CommandType | Sort-Object -Property Source, Name | Out-GridView
Note
Out-GridView
is not available in the Server Core version, as it lacks the graphical user interface. For Server Core installations, use Format-Table instead.
- Store the collection of PowerShell modules and a count into variables as well:
$CountOfModulesBeforeRSAT = Get-Module -ListAvailable | Tee-Object -Variable 'ModulesBeforeRSAT' | Measure-Object '{0} commands' -f $CountOfModulesBeforeRSAT.count
- View modules in
Out-GridView
:
$ModulesBeforeRSAT | Select-Object -Property Name -Unique | Sort-Object -Property Name | Out-GridView
- Review the RSAT Windows Features available and their installation status:
Get-WindowsFeature -Name RSAT*
- Install RSAT with sub features and management tools:
Install-WindowsFeature -Name RSAT -IncludeAllSubFeature ` -IncludeManagementTools
- Now that RSAT features are installed, see what commands are available:
$CountOfCommandsAfterRSAT = Get-Command | Tee-Object -Variable 'CommandsAfterRSAT' | Measure-Object '{0} commands' -f $CountOfCommandsAfterRSAT.count
- View commands in
Out-GridView
:
$CommandsAfterRSAT | Select-Object -Property Name, Source, CommandType | Sort-Object -Property Source, Name | Out-GridView
- Now check how many modules are available:
$CountOfModulesAfterRSAT = Get-Module -ListAvailable | Tee-Object -Variable 'ModulesAfterRSAT' | Measure-Object '{0} commands' -f $CountOfModulesAfterRSAT.count
- View modules in
Out-GridView
:
$ModulesAfterRSAT | Select-Object -Property Name -Unique | Sort-Object -Property Name | Out-GridView
- Store the list of commands into an XML file for later research:
$CommandsAfterRSAT | Export-Clixml ` -Path $env:HOMEPATH\Documents\WS2016Commands.XML"
In step 1, you use Get-Command
to enumerate all the commands available in PowerShell. This includes functions and aliases. It is useful to store the result of such commands into a variable, $CommandsBeforeRSAT
in this case, so you are able to investigate the commands without making the request again. Using Tee-Object
, you store the array of commands in that variable while continuing to use the pipeline to Measure-Object
to store the count of commands, then display the result using the PowerShell string formatting function: '{0} commands' -f $CountOfCommandsBeforeRSAT
In step 2, you pipe the $CommandsBeforeRSAT
variable to Get-Member
to examine the TypeName
of the objects returned, as shown in the following screenshot:
As you see, these commands are objects of the AliasInfo
, FunctionInfo
, and CmdletInfo
types in the System.Management.Automation
namespace (plus a FilterInfo
type, which provides information about a filter that is stored in the session state.) PowerShell commands returned by Get-Command
include aliases, functions, and cmdlets.
In step 3, you use Select-Object
to show the useful properties, and pipe that to a Sort-Object
, then pipe to Out-GridView
to search and filter the PowerShell commands, as you see in the following screenshot:
In step 4, you use Get-Module
just like Get-Command
, but use the -ListAvailable
parameter to see all the installed modules, not just those loaded into the current session. Again you use Tee-Object
to store the array of modules into a variable, $ModulesBeforeRSAT
, while passing the result down the pipeline to Measure-Object
to calculate the count which you then display.
In step 5, you pipe the variable to a Select-Object
for the interesting columns, Sort-Object
, then pipe that to Out-GridView
again to review the available modules as shown here:
In step 6, you view the RSAT features available in your server with Get-WindowsFeature -Name RSAT*,
as shown in the following screenshot:
Get-WindowsFeature
presents an information dense tree view of the RSAT tools available. Note the many sub-features under Remote Server Admin Tools
and under Role Administration Tools
. Each feature may be installed individually by name, or all features installed with one command as in this example.
In step 7, install all the RSAT
features with the -IncludeAllSubFeature
and-IncludeManagementTools
parameters. You may limit what is installed by changing the first parameter to a comma separated list of desired feature names.
In steps 8-11, once the RSAT features are installed, repeat the Get-Command
and Get-Modules
code to see all the additional cmdlets and modules.
In step 12 you use Export-CliXML
to store the array to an XML file. If you want to compare what is available in different OS and PowerShell versions, you use the array of objects saved to this file and compare it with an XML file generated under some other PowerShell or Windows versions.
Jose Barreto, a Principal Program Manager, Applications and Services Group at Microsoft, reviewed the new Windows Server 2016 cmdlets (based on Windows Server 2016 CTP). This post shows you how to use Export-CliXML
to see what has changed between PowerShell versions: