Archive for January, 2011

Scanning for Best Practices in Hyper-V Server 2008 R2

Hyper-V Server 2008 R2 is a server core installation of Windows Server 2008 R2, with the Hyper-V role installed by default and installation packages for a lot of infrastructure Server roles and features removed. For a complete listing, look here.

I, therefore, refer to it as the Hyper-V optimized edition of Windows Server 2008 R2. Also, I refer to Server Core installations as optimized installations of Windows Server. But, one of the great hurdles for systems administrators to start deploying and working with Server Core installations of Windows Server is the lack of most of the graphical tools. This, in my opinion leads to two common statements:

  • Server Core is only good for command line aficionados
  • You’ll need to know what you’re doing, since Server Core lacks helpful features.

While both statements might be true in some cases, I find the last statement a bit harsh. Server Core has many built-in features to help you not to destroy your system. Using diskpart.exe, for instance, you can’t format your system drive (which is where Windows resides). Another helpful feature is the Best Practices Analyzer (BPA). It is available in Server Core editions and yes, it’s available in Hyper-V Server 2008 R2.

This post is on scanning for best practices in Hyper-V Server 2008 R2 and view the results.

About Best Practices Analyzers

Best Practices Analyzers help to avoid common configuration errors, help to avoid situations of crashes and loss of data and help recovering when accidents do happen. Best Practices Analyzers , or BPAs as TLA-addicts like to call them, are not new to Microsoft products. Not even close, since the first Best Practices Analyzer, the Microsoft Exchange Server Best Practices Analyzer (ExBPA), was released in 2004… With Windows Server 2008 R2, however, they are an integral part of the Operating System and being updated through Windows Update. More information on the Best Practices Analyzers is available here.

   

Scanning from a remote system

One of the two ways to scan for Best Practices for Hyper-V Server 2008 R2 is to use Server Manager from a remote system.

Requirements

To allow remote management, the following requirements need to be met:

  • The remote system needs to either be a Full installation of Windows Server 2008 R2 or a Windows 7 installation with the Remote Server Administration Tools (RSAT) installed.
  • Both the Hyper-V Server 2008 R2 box and the remote system need to be joined to the same Active Directory domain. (workaround here under Logon Considerations) Any supported Active Directory functional level

Steps

The first thing you need to do on your Hyper-V Server 2008 R2 box is to enable remote management. The Server Configuration Tool (Sconfig, replacing HVconfig from Hyper-V Server 2008) is the perfect tool to configure this. Type the following command to start the Server Configuration Tool:

sconfig

In the Server Configuration Tool, enable remote management by choosing menu option 4. Afterwards type 1, followed by Enter, to enable remote MMC management, type 2, followed by Enter to enable Windows PowerShell and type 3, followed by Enter, to enable Server Manager Remote Management. Afterwards, restart your Hyper-V Server 2008 R2.

Remote management from Windows Server 2008 R2

From a Full installation of Windows Server 2008 R2, simply fire up Server Manager (if it doesn’t start automatically after logon) and point it to your Hyper-V Server box. Point it to the name or IP address of your Hyper-V Server box, by clicking on the Server Manager node in the navigation (left) pane. Then, click the Hyper-V Server Role in the left navigation pane of Server Manager. In the Summary screen (in the main pane) you can scroll down to the Best Practices Analyzer section. Here you can:

  • Start Best Practices Analyzer Scans using Scan This Role
  • Review Best Practices Analyzer results
  • Include and/or exclude specific Best Practices Analyzer results

  

Remote management from Windows 7 with RSAT

Remotely managing Hyper-V Server 2008 R2 from Windows 7 requires some more steps to configure (but less money to purchase!):

  • Download the Remote Server Administration Tools (RSAT).
  • Install the freshly downloaded Standalone Update Package for RSAT.
  • Enable the Server Manager Remote Management feature through Turn Windows Features on and off (either from the Control Panel or the search bar in the Start Menu)
  • Show the Administrative Tools folder on the Start Menu by right-clicking on an empty area of the Windows 7 taskbar (Superbar) and select Properties from the context menu. Then click the Start Menu tab. Afterwards, click the Customize button. Scroll down to System administrative tools and adjust the display settings to suit your need. You can place the folder in the All Programs menu, on the All Programs menu and the Start menu or not at all (which is the default). Click OK on the dialog boxes to close them.
  • Now start Server Manager either from the Administrative Tools folder or from the Search bar in the Start Menu.
  • Point Server Manager to the name or IP address of your Hyper-V Server box, by clicking on the Server Manager node in the navigation (left) pane.
  • Then, click the Hyper-V Server Role in the left navigation pane of Server Manager. In the Summary screen (in the main pane) you can scroll down to the Best Practices Analyzer section.

  

Scanning from the command line

As seen above, remotely scanning for Best Practices on a Hyper-V Server 2008 R2 box may put some requirements in your way, like upgrading at least another server to Windows Server 2008 R2 or migrating a workstation to Windows 7. When you’re not quite ready for these steps, or you want the flexibility to scan for Best Practices periodically (by scripting it) you might also opt to scan for Best Practices from the command line.

To be able to perform Best Practices Scans straight from the console of the Hyper-V Server 2008 R2 box, you first have to enable PowerShell and the Server Manager and Best Practices PowerShell commandlets. To do so, type the following commands:

dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell
dism /online /enable-feature /featurename:ServerManager-PSH-Cmdlets
dism /online /enable-feature /featurename:BestPractices-PSH-Cmdlets

You’re now able to perform Best Practices scans. To do so, run the following commands:

powershell.exe
Import-Module ServerManager
Import-Module BestPractices
Invoke-BPAModel –BestPracticesModelID Microsoft/Windows/Hyper-V

Finish off with an export of the Best Practice Results.
My choice is to export to HTML and get the file off the host afterwards, where it can be read on any Operating System. I use the following (one) command for that:

Get-BpaResult -BestPracticesModelId Microsoft/Windows/Hyper-V | Where-Object {$_.Severity -eq "Error" -or $_.Severity -eq “Warning” } | ConvertTo-Html -Property Severity,Category,Title,Problem,Impact,Resolution,Help -Title "BPA Report for Hyper-V" -Body "BPA Report for Hyper-V <HR>" –Head "<title>BPA Report</title><style type=’text/css’> table  { border-collapse: collapse; width: 700px } body   { font-family: Arial } td, th { border-width: 2px; border-style: solid; text-align: left; padding: 2px 4px; border-color: black } th     { background-color: grey } td.Red { color: Red } </style>"  | Out-File "C:bpa.html"

   

Concluding

Hyper-V Server 2008 R2 offers Best Practice Scanning capabilities. Depending on your situation you can either scan from a remote system or straight from the console of the Hyper-V Server 2008 R2 box.

The Best Practice Analyzer scans and their results, might help you in avoiding disasters or getting out of a disaster faster.

Further reading

Best Practices Analyzer
Hyper-V Best Practices Analyzer PowerShell Automation
Updates for Best Practices Analyzer
Best Practices Analyzer Updates for Server 2008 R2
Microsoft releases a Best Practices Analyzer for Hyper-V
Best Practices Analyzer for Hyper-V – First Impressions
Best Practices Analyzer: Run it on your server roles, not your loved ones
PRC08: Best Practices for Deployments and Upgrades – Takeaways
Best Practice Analyzers for Windows Servers / Exchange
Best Practice Analyzer for Hyper-V – What does it check?