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

Start-DSCEAscan -OutputPath folder doesn't exist before execution #75

Open izblah opened 5 years ago

izblah commented 5 years ago

If the folder specified in -OutputPath doesn't exist prior to running Start-DSCEAscan, the scan will run and will fail when attempting to save the output, losing all of your data.

The CmdLet should gracefully check for the existence of the folder before starting any scans, or perhaps go ahead and create one if it doesn't already exist.

`PS C:\Users\user\Desktop> Start-DSCEAscan -MofFile .\localhost.mof -ComputerName COMPUTER -OutputPath .\DSCEA -Verbose VERBOSE: DSCEA Scan has started VERBOSE: Connectivity testing complete VERBOSE: Initiating DSCEA scan on COMPUTER VERBOSE: Processing Compliance Testing... VERBOSE: Total Scan Time: 00:23:55 Export-Clixml : Could not find a part of the path 'C:\Users\user\Desktop\DSCEA\results.20190618-1508-48.xml'. At C:\Program Files\WindowsPowerShell\Modules\DSCEA\1.2.0.0\Functions\Start-DSCEAscan.ps1:383 char:16