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.