silverhack/monkey365

[Bug]: Can't select more than one ExportTo options

Closed this issue · 4 comments

What happened?
When running monkey365, I try different ExportTo options and none work, only when a single option is specified works.

How to reproduce it
Steps to reproduce the behavior:

  1. What command are you running?
    $param = @{
    Instance = 'Azure';
    Analysis = 'All';
    PromptBehavior = 'SelectAccount';
    subscriptions = '000000-00000000-0000';
    TenantID = '000000-00000000-0000';
    ExportTo = "CSV,JSON,CLIXML,PRINT,EXCEL,HTML";
    }
    $assets = Invoke-Monkey365 @param
  2. See error
    Invoke-Monkey365: Cannot validate argument on parameter 'ExportTo'. The argument "JCSV,JSON,CLIXML,PRINT,EXCEL,HTML" does not belong to the set "CSV,JSON,CLIXML,PRINT,EXCEL,HTML" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
    Expected behavior
    Get output in the formats specified

From where are you running Monkey365?
Please, complete the following information:

  • Resource: Workstation
  • OS: Windows 10
  • PowerShell Version [$PsVersionTable]: 7.2.6
  • Monkey365 Version:
  • Others:

Hey @cibermanchego hope you're doing well.

According to the error message, it seems that you have misspelled "JCSV" as "CSV". To avoid misspelling commands, please make use of TAB-completion in PowerShell.

Please, also note that the -ExportTo is declared as an [Array], and quotation marks are used to specify a literal string, instead an Array. The following command should work:

$param = @{
    Instance = 'Azure';
    Analysis = 'All';
    PromptBehavior = 'SelectAccount';
    subscriptions = '000000-00000000-0000';
    TenantID = '000000-00000000-0000';
    ExportTo = @("CSV","JSON","CLIXML","PRINT","EXCEL","HTML");
}
$assets = Invoke-Monkey365 @param

On the other hand, it seems that there are some (stupid) small typo errors in the markdown docs, so I'll leave this opened until is resolved.

Cheers

Thank you for the quick response. True, there is a typo on the text I pasted, but I tried with several combinations(with no typos) and only worked with a single option.
I was using the example from the documentation:

image

After I got the errors I should have checked the help for Invoke-Monkey365, where it says that ExportTo parameter it's an array; my bad.
Still I was able to use the tool, and it's great, thank you!

Hey @cibermanchego, docs are now fixed in both develop and main branches.

Thank you for letting me know! :D

Cheers,

Thank you for the great tool and the effort you put in maintaining it.