Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

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

@izblah

Description

@izblah

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

  • ... $results | Export-Clixml -Path (Join-Path -Path $OutputPath -Child ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OpenError: (:) [Export-Clixml], DirectoryNotFoundException
    • FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportClixmlCommand`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions