How to use HYPER-V Best Practices Analyzer in Windows Server 2016

When must design and implement an infrastructure of an environment it's very important to begin in right direction. Imagine that you must build a HYPER-v Server with 20 VM's or more. Lot of Virtual Machine has a high workload.

You must be sure that your infrastructure it's design correctly without need to do important changes when HYPER-V go live.

Microsoft can help you with Best Practices Analyzer(BPA) in Windows Server 2016 and in HYPER-V Role.

Of course  every Best Practices it's not 100% accurate but it's sure that can help you to see issues or configurations that maybe you don't have think about it.

What is Best Practices Analyzer

Best Practices Analyzer is a Management Tool that can help IT Pro to reduce best practices violations by scanning roles that are installed in Windows Server. You can use BPA to configure correctly a Windows Server but base on circumanstences it's not mean thay you must be 100% accurate for the results of the Best Practices Analyzer scan. 

I will give you to understand what i mean when will be describe the errors that get from Scan

How to run Best Practices Analyzer from GUI

So let's start to see how can use Best Practices Analyzer(BPA) when build a HYPER-V Host.

  • Open Server Manager.
  • From the left side click in HYPER-V
  • Scroll down until find the Best Practices Analyzer
  • From the left side click Tasks - - > Start BPA Scan

 

  • Select the Server that you want to Scan. Here is a local Server but you can use and other servers in your network
  • Wait a few minutes and you will get the results.

 

How to run Best Practices Analyzer from Powershell

Except from GUI Best Practices Analyzer can run from Powershell. The only disadvantage to run Powershell for BPA Scan is that need to run more commands to get the results.

  • Open Powershell
  • To find the ID of the BPA you must run the following command

    Get-Bpamodel

  • Find the ID of the the Role that you want to scan for BPA
  • In our scenario the Role is the HYPER-V

 

  • So type

    Invoke-BpaModel -ModelId Microsoft/Windows/Hyper-V

  • After run the command you will get the following results.

 

How to retrieve the results from Powershell

In powershell you can retrieve the results in different formats.

  • In Csv File with Export-Csv
  • In Grid View with Out-GridView
  • In Format Table from Powershell with FormatTable

Let's start to run the following command and retrieve the results. But the output that get it's very hard to read it.

Get-BpaResult -ModelId Microsoft/Windows/Hyper-V

So we can use the Export-Csv or Out-GridView to get the results in different formats easier to read it.

Get-BpaResult -ModelId Microsoft/Windows/Hyper-V | Export-Csv c:\Bparesults

Or

Get-BpaResult -ModelId Microsoft/Windows/Hyper-V | Out-GridView

But you see that you retrieve all the results from Scan and not only the Warnings and Errors.

When you run a Scan you want to know which are the Best Practices that you aren't pass.

So let's go to filter the results and get only the Warnings and Errors

 

How to filter the results with Powershell 

Let's run the command to retrieve the results in Out GridView.

Get-BpaResult -ModelId Microsoft/Windows/Hyper-V | Out-GridView

You can see a Field with Name Severity which include the results Informational,Warning,Errors.

This field is exactly what we want. We can filter base on the Field Severity to get only the results with Warnings an Errors.

 

So use the Where with comparison operator -notlike to filter the results

Get-BpaResult -ModelId Microsoft/Windows/Hyper-V | Where { $_.Severity -notlike "Information"} | Out-GridView

This is an example that use to take filter results to read only what i want.

 

You can use this tactic t filter any field that you want base on your requirements

 

Have a nice weekend !!

 

I invite you to follow me on Twitter or Facebook. If you have any questions, send email to me at info@askme4tech.com.