Book Image

Windows Server 2016 Administration Cookbook

By : Jordan Krause
Book Image

Windows Server 2016 Administration Cookbook

By: Jordan Krause

Overview of this book

<p>Windows Server 2016 is an operating system designed to run on servers. It supports enterprise-level data storage, communications, management, and applications. This book contains specially selected, detailed help on core, essential administrative tasks of Windows Server 2016.</p> <p>This book starts by helping you to navigate the interface of Windows Server 2016, and quickly shifts gears to implementing roles that are necessarily in any Microsoft-centric datacenter.</p> <p>This book will also help you leverage the web services platform built into Windows Server 2016, available to anyone who runs this latest and greatest Server operating system. Further, you will also learn to compose optimal Group Policies and monitor system performance and IP address management.</p> <p>This book will be a handy quick-reference guide for any Windows Server administrator, providing easy to read, step-by-step instructions for many common administrative tasks that will be part of any Server Administrator’s job description as they administer their Windows Server 2016 powered servers.</p> <p>The material in the book has been selected from the content of Packt's Windows Server 2016 Cookbook by Jordan Krause to provide a specific focus on key Windows Server administration tasks.</p>
Table of Contents (12 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Using PowerShell to accomplish any function in Windows Server


An incredibly powerful tool in Windows Server 2016 is PowerShell. Think of PowerShell like a Command Prompt on steroids. It is a command-line interface from which you can manipulate almost anything inside Windows that you may care to. Better yet, any task that you may wish to accomplish can be scripted out in PowerShell and saved off as a .ps1 script file, so that you can automate large tasks and schedule them for later, or at regular intervals. In this recipe, let's open up PowerShell and run some sample commands and tasks just to get a quick feel for the interface. In a later chapter of the book, we will do some more specific tasks with PowerShell to go even deeper into the technology.

Getting ready

To start using PowerShell, all you need is a server with Windows Server 2016 installed. PowerShell is installed and enabled by default.

How to do it...

To get a feel of using PowerShell, perform the following steps:

  1. PowerShell used to exist in the taskbar by default, which was smart because we really should be pushing people to use it rather than Command Prompt, right? Unfortunately, PowerShell is not in the taskbar by default in Server 2016, but the Windows Store is...? Explain that one to me some day. So our first step to working in PowerShell is finding it. Thankfully, we know how to search for applications now, so I'll just press my WinKey and type PowerShell. Once my search result is displayed, I am going to right-click on Windows PowerShell and choose to Run as administrator:
  2. Test out some commands that you are familiar with from using the Command Prompt, such as dir and cls. Since you are able to make use of these familiar commands, PowerShell can really be your one and only command-line interface if you choose.
  1. Now let's try some of the PowerShell secret sauce, one of its cmdlets. These are special commands that are built into Windows and allow us to do all kinds of information gathering, as well as manipulation of server components. Let's start by pulling some data. Maybe take a look at what IP addresses are on the system with Get-NetIPAddress:
  2. The previous command probably gave you a lot more information than you needed, since most companies don't make use of IPv6 inside their network yet. Let's whittle this information down to the IPv4-specific info that you are most likely interested in. Enter Get-NetIPAddress -AddressFamily IPv4 to attain it:

How it works...

PowerShell has so many commands and cmdlets, we just wanted to get a feel for launching the program and pulling some data with this particular recipe. There are countless Get commands to query information from the server, and as you have seen those cmdlets have various parameters that can be appended to the cmdlets to pull more specific data to meet your needs. To make things even better, there are not only Get cmdlets, but also Set cmdlets, which will allow us to make use of the PowerShell prompt to configure many aspects of the configuration on our server, as well as remote servers. We will dive further into PowerShell in a later chapter.