How it works...

In this recipe, we created a fun little script that asks for a server name and outputs the last boot information for the server entered. One of PowerShell's greatest attributes is its ability to grab information, both locally on the machine where you are running the script and on remote machines. This saves time, since you don't have to log into those servers to accomplish tasks, and makes your work environment more efficient.

One note on this particular script that we created, you don't have to run it as a first step and then take a second step in order to enter the server name. You are able to place the ServerName variable into your initial command when you launch the script. For example, open PowerShell and input the following ...

Get Windows Server 2016 Administration Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.