microsoft / DSCEA

DSC Environment Analyzer (DSCEA) is a simple implementation of PowerShell Desired State Configuration that uses the declarative nature of DSC to scan systems in an environment against a defined reference MOF file and generate compliance reports as to whether systems match the desired configuration.
https://microsoft.github.io/DSCEA
Other
197 stars 41 forks source link

Question about Start-DSCEAScan #37

Closed skest3qc closed 7 years ago

skest3qc commented 7 years ago

Hi,

first thanks for this great module.

Each node in my environment has a separate mof file.

Start-DSCEAscan -ComputerName node1 -OutputPath "$OutputPath" -MofFile "node1.mof" Start-DSCEAscan -ComputerName node2 -OutputPath "$OutputPath" -MofFile "node2.mof" So this produces me a XML file for each node.

I would like to know if it is somehow possible to create a detailed or compliance report from a collection of xml files?

So that I have one HTML of the compliance of all servers?

Thanks

krjhitch commented 7 years ago

That makes sense. This is definitely a scenario we should support, since it's a common configuration. Currently the -ReferenceConfiguration takes a single .MOF, but since Test-DSCConfiguration without -ReferenceConfiguration just uses a path of MOF files for each system, we should support that. I'll start looking into it. Thanks!

krjhitch commented 7 years ago

Made a -Path parameter for Start-DSCEAScan which looks into a path and uses each named MOF against it's respective system. The changes are on the live on the dev branch, if you want to download them and play with it.

skest3qc commented 7 years ago

Hi,
thanks I just tested it, it works.

However when I start Start-DSCEAScan I get this error: `Get-Item : Cannot find path 'C:\DSC\localhost.mof' because it does not exist. At C:\Program Files\WindowsPowerShell\Modules\DSCEA\1.1.0.1\Functions\Start-DSCEAscan.ps1:128 char:17

The variable cannot be validated because the value is not a valid value for the MofFile variable. At C:\Program Files\WindowsPowerShell\Modules\DSCEA\1.1.0.1\Functions\Start-DSCEAscan.ps1:128 char:5

The scan works and I can create a HTML file from it

krjhitch commented 7 years ago

When you run Start-DSCEAScan it assumes there's a .\localhost.mof file, otherwise you need to run Start-DSCEAScan -MofFile C:\location\whatever.mof, but it should probably have a better error message/test for it's existence. I'll have to mark that as an issue.

skest3qc commented 7 years ago

Made a -Path parameter for Start-DSCEAScan which looks into a path and uses each named MOF against it's respective system. The changes are on the live on the dev branch, if you want to download them and play with it

I thought the -Path parameter was made to look into this directory and process all named MOF files. There is no need for a localhost.mof?

Thanks

krjhitch commented 7 years ago

I see it now. It looks like we started with the Get-Item for the MOF full path because it was either passed in as a parameter (or assumed .\localhost.mof) and when I added the -Path parameter, the -MofFile defaulted to it's .\localhost.mof which didn't necessarily exist on the system calling the function in order for the function to work (because it properly processed the MOFs specified by -Path).

I added the the -MofFile parameter to a parameterset so that it can't be specified in conjunction with -Path and I moved $MofFile = (Get-Item $MofFile).FullName into the parts of the code that support the parametersets that actually use them.

Thanks!

skest3qc commented 7 years ago

Thanks

skest3qc commented 7 years ago

Tried the dev branch and get this error when running Start-DSCEAScan -Path SomePath: `Cannot find an overload for ".ctor" and the argument count: "2". At C:\Program Files\WindowsPowerShell\Modules\DSCEA\Functions\Start-DSCEAscan.ps1:99 char:9

Import-Clixml : Cannot bind argument to parameter 'Path' because it is an empty string. At C:\Program Files\WindowsPowerShell\Modules\DSCEA\Functions\Get-DSCEAreport.ps1:88 char:30

rkyttle commented 7 years ago

I am able to repro the "Cannot find an overload for ".ctor" and the argument count" issue when I test the following command: Start-DSCEAscan -MofFile .\localhost.mof -ComputerName dsctest-1, dsctest-2, dsctest-3

We will take a look into this

rkyttle commented 7 years ago

This issue should be resolved in the next release