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 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...