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

Generating performance monitoring graph


In the previous recipe, you created a simple text based report which you could expand to cover not just the CPU on the SRV1 server, but more counters across multiple machines. But they would be pure text. You could use performance monitor and the binary log files to create Perfmon graphs you could cut/paste into a report.

In this recipe, you use the data generated using the data collector mechanism to draw a graph using classes from the Windows.Forms.DataVisualization namespace.

Getting ready

Like the Reporting on performance data recipe, this recipe uses CSV files from the data collection process noted earlier.

How to do it...

  1. Load the System.Windows.Forms and System.Windows.Forms.DataVisulization assemblies:
Add-Type -AssemblyName System.Windows.FormsAdd-Type -AssemblyName System.Windows.Forms.DataVisualization
  1. Import the CSV data from earlier, and fix row 0:
$CSVFile = Get-childitem -Path C:\PerfLogs\Admin\*.csv `
                               -Recurse...