Book Image

Windows Server 2016 Automation with PowerShell Cookbook - Second Edition

By : Thomas Lee, Ed Goad
Book Image

Windows Server 2016 Automation with PowerShell Cookbook - Second Edition

By: Thomas Lee, Ed Goad

Overview of this book

This book showcases several ways that Windows administrators can use to automate and streamline their job. You'll start with the PowerShell and Windows Server fundamentals, where you'll become well versed with PowerShell and Windows Server features. In the next module, Core Windows Server 2016, you'll implement Nano Server, manage Windows updates, and implement troubleshooting and server inventories. You'll then move on to the Networking module, where you'll manage Windows network services and network shares. The last module covers Azure and DSC, where you will use Azure on PowerShell and DSC to easily maintain Windows servers.
Table of Contents (21 chapters)
Title Page
Credits
About the Author
Acknowledgment
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Explore performance counters with Get-Counter


Get-Counter is the cmdlet you use both to discover the counter sets available on a machine, and to obtain performance samples from a local or remote server. In this recipe, you use a Windows Server 2016 server, SRV1, to examine performance counter sets and counters on local and remote computers.

Getting ready

This recipe uses several remote machines: DC1, CA, SRV1, FS1, FS2, and PSRV. Adjust the recipe to reflect the computers in your testing or production environment.

This recipe uses several servers to simulate a normal organization. Consider using fewer servers.

How to do it...

  1. You start by using Get-Counter to discover performance counter sets on the local machine:
$CounterSets = Get-Counter -ListSet *  "There are {0} counter sets on [{1}]" `
                                   -f $CounterSets.count, (hostname)
  1. Discover performance counter sets on remote systems:
$Machines = 'DC1', 'CAa', 'SRV1', 'FS1', 'FS2', 'PSRV' foreach ($Machine in $Machines...