To be able to use the script you will need to have installed the Microsoft Baseline Configuration Analyzer 2.0 (MBCA) http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=16475 and the Windows Server Solutions Best Practices Analyzer 1.0 http://www.microsoft.com/download/en/details.aspx?id=15556 (Update to version 1.1 via Microsoft Update after manually installing 1.0)
Now that we have all the pre-requisites installed we can focus on the Powershell Script that allows us to automate the scanning process. The script below will initilise the MBCA and then carry out a Best Practices scan based upon the Server Solutions BPA, this can either be used as a standard powershell script where required or setup to run on a schedule with GFI Max Remotemanagement or SpiceWorks.
Import-module BaselineConfigurationAnalyzer
Get-MBCAModel
Invoke-MBCAModel -ModelId WSSGBPA
This should return a “Success: True” if everything matches the Best Practices Analyser.