上QQ阅读APP看书,第一时间看更新
How to do it...
- You use the Get-Command, and Tee-Object cmdlets to retrieve both the collection of PowerShell commands and the number of cmdlets into PowerShellvariables 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
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*
Get-WindowsFeature only works on Windows Server operating systems.
- 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"