This recipe assumes you have set up the VM farm for this book as described in the Preface to the book. In particular, this recipe uses a Windows Server 2019 host running as a domain controller (DC1
), a Windows 10 client computer (CL1
), plus two domain-joined servers (SRV1
, SRV2)
.
Your client system should be Windows 10 Enterprise or Professional. Once you have installed the operating system, you should customize it with some artifacts used throughout this book, as follows:
These steps create the C:\Foo
folder, create a profile, and update the PowerShell help information. You can add other customizations to these steps, such as adding VS Code or other third-party modules.
This recipe installs the RSAT tools on both a Windows 10 domain-joined computer (CL1
) and on several Windows 2019 servers. The recipe also displays the results of the installation. You begin, in step 1, by getting all the commands available on the Windows 10 host and display a count.
Depending on the specific version of Windows 10 you use and what tools you may have already added to the client, the counts may be different. Here is what the output of this step looks like:
As you can see, 1528
total commands existed prior to adding the RSAT tools. In step 2, you examine the different types of command that make up that total, as shown here:
PowerShell includes aliases, functions, filters, and cmdlets as commands. Adding the RSAT tools increases the number of commands available. In step 3, you display a count of the modules installed currently, which looks like the following:
In step 4, you obtain the hardware platform and the Windows 10 version, which looks like this:
In step 5, you create a URL for downloading the RSAT tools. Different versions exist for different hardware platforms (for example, x86
and amd64
) and for major Windows 10 versions (1709
and 1803
). In step 6, you display the URL, which looks like this:
In step 7, you use the Background Intelligent Transfer Service (BITS) to retrieve the URL and store it as C:\Foo\Rsat.msu
. The transfer produces no output.
In step 8, you check the Authenticode digital signature of the downloaded file to ensure the file was transferred correctly and has not been tampered with, which looks like this:
In step 9, you run the downloaded file that installs the RSAT tools. Aside from the message that the script is installing the RSAT tools, PowerShell runs this silently and there is no additional output from this step.
In Step 10, you determine that CL1
now has a total of 1270
commands, as shown:
In step 11, you discover the number of RSAT tools and the total of modules now available on CL1
, as shown:
In step 12, you display the modules that were added to CL1
, which looks like this:
The preceding steps complete the task of installing the RSAT tools on a Windows 10 client. In some cases, you may also want to install the relevant tools on some or all of your servers.
In this part of the recipe, you are installing the RSAT tools onto server SRV1
. You then compare the tools added to SRV1
with what is available on other servers (for example, DC1
and SRV2
). In this case, DC1
is a domain controller with other features added during creation of the DC1
server. SRV2
, on the other hand, starts as just a domain-joined server with no additional tools.
In step 13, you determine the features available on the three servers—this produces no output. In step 14, you display a count of the features and RSAT features available on each server, which looks like this:
In step 15, you install the RSAT tools remotely on SRV1
. To complete the installation, you also reboot the server if the installation requires a reboot. The output looks like the following:
In step 16, you determine the features now available on the three servers, producing no output, and finally, in step 17, you display the results, as follows:
In step 1, you saw that there were 1528
commands loaded on CL1
while in step 4 you saw that you had 77 modules on your system. PowerShell gets commands primarily from modules, although older PowerShell snap-ins also contain cmdlets. If you wish to use a command contained in a snap-in, you have to load the snap-in explicitly by using Add-PSSnapin
. PowerShell can only auto-load commands found in modules.
In step 4 and step 5, you calculate and display a URL to download the RSAT tools. These recipe steps work for two versions of Windows 10 and for two hardware platforms. The URLs and versions of Windows 10 available may have changed by the time you read this. Also, the recipe caters just for Windows 10 versions 1709 and 1803. Download files for earlier versions are not available in the same way as for later versions. And for versions later than 1893, the mechanism may change again.
In step 15, when you displayed the results of adding features to SRV1
, the output looked different if the formatting had been done on the server. On the server, PowerShell is able to display XML that states how to format output from WindowsFeature
cmdlets. Windows 10 does not display XML, hence the list output in this step.