Book Image

Windows Server 2016 Cookbook

By : Jordan Krause
Book Image

Windows Server 2016 Cookbook

By: Jordan Krause

Overview of this book

This hands-on Cookbook is stuffed full of practical recipes that will help you handle the essential administrative tasks in Windows Server 2016. You’ll start by familiarizing yourself with the look and feel of Windows Server 2016, and will then learn how to navigate through some daily tasks using the graphical interface. You will see how to compose optimal Group Policies and facilitate task automation with PowerShell 5.0 scripting. We will also take a look at the functions available to provide remote network access to your traveling users, and explore the much anticipated Nano Server and Hyper-V built-in integration support that is brand new in Windows Server 2016. By the end of this book, you will know how to take your Windows Server 2016-powered server and turn it into any common infrastructure role that might be required in your company.
Table of Contents (18 chapters)
Windows Server 2016 Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Using PowerShell to view system uptime


I find myself constantly checking servers to figure out what time they last restarted. Usually, this is part of troubleshooting something in order to figure out whether the server rebooted as a planned action or if something went wrong and it restarted on its own during a non-standard time. For years, I had launched Event Viewer, waited for the System logs to open, hoped that they weren't corrupted in some way, and then headed over to noon on the previous day to find the number of seconds that the system had been online. Then I'd pull out the calculator and do the math for how many days/hours that really was. Way too complicated! Thankfully, we can make calls into WMI objects with PowerShell, and there is an object in there that will tell us the last time the server started. With a few lines plugged into a .ps1 script, we can create ourselves a nice little tool that will output the last time that a server booted. Let's give it a try.

Getting ready

We...