Book Image

Windows Server 2019 Cookbook - Second Edition

By : Mark Henderson, Jordan Krause
Book Image

Windows Server 2019 Cookbook - Second Edition

By: Mark Henderson, Jordan Krause

Overview of this book

Do you want to get up and running with essential administrative tasks in Windows Server 2019? This second edition of the Windows Server 2019 Cookbook is packed with practical recipes that will help you do just that. The book starts by taking you through the basics that you need to know to get a Windows Server operating system working, before teaching you how to navigate through daily tasks using the upgraded graphical user interface (GUI). You'll then learn how to compose an optimal Group Policy and perform task automation with PowerShell scripting. As you advance, you’ll get to grips with faster app innovation, improved Windows security measures, and hybrid cloud environments. After you’ve explored the functions available to provide remote network access to your users, you’ll cover the new Hyper-V enhancements. Finally, this Windows Server book will guide you through practical recipes relating to Azure integration and important tips for how to manage a Windows Server environment seamlessly. By the end of this book, you’ll be well-versed with Windows Server 2019 essentials and have the skills you need to configure Windows services and implement best practices for securing a Windows Server environment.
Table of Contents (18 chapters)

Searching for PowerShell cmdlets with Get-Help

With this recipe, we'll spend a minute using Get-Help inside PowerShell in order to, well, get some help! I see both new and experienced PowerShell administrators going to the web a lot in order to find commands and the parameters of those commands. The internet is great, and there is a ton of data out there about how to use PowerShell, but in many cases, the information that you are looking for resides right inside PowerShell itself. By using the Get-Help cmdlet combined with the functions you are running or searching for, you might not have to open that web browser after all.

Getting ready

We will be running some commands from inside PowerShell on a Windows Server 2019 machine.

How to do it…

To use the Get-Help function inside PowerShell, run the following steps:

  1. Launch a PowerShell prompt.
  2. Type Get-Help.
  3. You may be asked to run Update-Help to download the latest help from the internet – you can do this if you wish (although it can sometimes take a while).
  4. You're finished! No, I'm just kidding. Using Get-Help by itself will present you with some helpful data about the Get-Help command, but that's not really what we are looking for, is it? How about using Get-Help with a search parameter, like this:
    Get-Help Computer

    The following is the output:

    Figure 1.36 – Running Get-Help Computer

    Figure 1.36 – Running Get-Help Computer

    Cool! That searched the available cmdlets and presented us with a list of the ones that contain the word Computer.

  5. Now, what if we wanted to find out some more particular information about one of these cmdlets – maybe about Restart-Computer, which we used earlier? Use the following command:
    Get-Help Restart-Computer

The following is the output:

Figure 1.37 – Running Get-Help Restart-Computer

Figure 1.37 – Running Get-Help Restart-Computer

Now we're really cooking! This is wonderful information.

There are many sections of help in the Get-Help output, and you may not see them all by default. Try running Get-Help Restart-Computer -Full to see all of them! This is basically what you would find if you were looking for information about the Restart-Computer cmdlet and went searching on TechNet for it.

How it works…

The Get-Help cmdlet in PowerShell can be used with virtually any command in order to find out more information about that particular function. I often use it when the specific name of a cmdlet that I want to use escapes my memory. By using Get-Help as a search function, it will present a list of available cmdlets that include the keyword you specified. This is a brilliant function in PowerShell and is just another example of why PowerShell should replace your usage of the Command Prompt.

Also included with the Get-Help files are all the special syntax and parameter options for each cmdlet that you might be working with. This saves you having to go to the web in order to search for these functions, and it is just way more fun doing it at the command line than in a web browser.