SQL 2012 Baseline PowerShell Helper for Compliance Scanning doesn't seem to work

已答覆 SQL 2012 Baseline PowerShell Helper for Compliance Scanning doesn't seem to work

  • Wednesday, March 20, 2013 7:48 AM
     
     

    Hi, I can't get the PowerShell helper to work.

    I've used SCM 3.0 to import the beta SQL2012 security baseline. Did a few changes, then exported it to an SCM .cab file. I've copied this cab file to a freshly installed SQL 2012 server running on windows 2008 R2 in a c:\temp directory. On this server I've installed the PowerShell helper.

    I've changed the execution policy to remotesigned and have added the helper directory to the path using $env:Path = $env:Path + ";C:\Program Files\Microsoft\SolutionAccelerators\Modules\Microsoft.SolutionAccelerator.Baseline.SQLServer;"

    Then changed dir to c:\temp and executed the command Get-ComplianceReport -SCMBaseline c:\temp\test_export.cab -ExportPath c:\temp\test_report.xml -Report True -DebugInfo True

    The command seems to run for 10-20 seconds. $? evaluates to True. There is no output and no test_report.xml created. What am I doing wrong?

All Replies

  • Wednesday, March 20, 2013 3:07 PM
     
     Answered Has Code

    Ok, I've got it to work. It turns out PSModulePath needs to be set to include the helper modules and the module needs to be imported before running Get-Compliance report.

    Here's how:

    1. install SQLServerBaselinePowerShellHelper.msi

    2. create a temporary directory (i.e. c:\scmtest) and copy the exported SCM .cab baseline to this 

    3. run Windows PowerShell with local administrator privileges and use the following commands

    Set-ExecutionPolicy RemoteSigned $env:Path += ";C:\Program Files\Microsoft\SolutionAccelerators\Modules\Microsoft.SolutionAccelerator.Baseline.SQLServer\" $env:PSModulePath += ";C:\Program Files\Microsoft\SolutionAccelerators\Modules\" Import-Module Microsoft.SolutionAccelerator.Baseline.SQLServer

    Get-ComplianceReport -SCMBaseline c:\scmtest\test_scm_export.cab -ExportPath c:\scmtest\report.xml

    Now the report in xml format will be created. You can use the parameter -DebugInfo $TRUE if you want to see debug output.

    So, now I have a nice XML file. How do I create a human readable report from this? Is there a stylesheet for this or do I need to use a specific program to view it?

    • Marked As Answer by weergavenaam11 Wednesday, March 20, 2013 3:40 PM
    •