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

Creating a system diagnostics report


The PLA subsystem that you have been working with in this chapter has an additional kind of report that the PLA and PowerShell can generate, a System Diagnostic report. This report is simple to create and makes use of some of the approaches used in this chapter.

Getting ready

You run this recipe on server SRV1.

How to do it...

  1. Start the data collector on the local system:
$PerfReportName="System\System Diagnostics"  $DataSet = New-Object -ComObject Pla.DataCollectorSet$DataSet.Query($PerfReportName,$null)$DataSet.Start($true)
  1. Wait for the data collector to finish:
Start-Sleep -Seconds $Dataset.Duration
  1. Get the report and view it:
$Dataset.Query($PerfReportName,$null)$PerfReport = $Dataset.LatestOutputLocation + "\Report.html"& $PerfReport

How it works...

In step 1, you create a PLA.DataCollectorSet object and use it to query then start the Systems Diagnostics report. This report comes built into Windows, but you update it (or create customized reports if you...