Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi everyone,

I'm currently using Monkey365 (v0.95.1) to run a Microsoft 365 security assessment. I'm executing a collection that includes AdminPortal, ExchangeOnline, MicrosoftTeams, and SharePointOnline (Purview was excluded due to connection issues).

However, when I run the following:

$options = @{
Instance = 'Microsoft365';
Collect = @('AdminPortal','ExchangeOnline','MicrosoftTeams','SharePointOnline');
PromptBehavior = 'SelectAccount';
IncludeEntraID = $true;
ExportTo = @('CSV', 'HTML');
WriteLog = $true;
}
Invoke-Monkey365 @options

I get this error:

Write-Error : [Invoke-M365Scanner] - Unable to create var object: The property 'VerbosePreference' was not found on this object. Verify that the property exists.
At C:\Monkey365\core\tasks\Initialize-MonkeyScan.ps1:99 char:13

  • throw ("{0}: {1}" -f "Unable to create var object",$_.Exception.Message)

Has anyone run into this issue?

Thanks in advance to anyone who can share insights or confirm the best approach.

You must be logged in to vote

Replies: 2 comments · 2 replies

Comment options

Hey @roohfelix I can confirm that it's a bug and only appears when the -Verbose option is not set. I'll add this as a new issue.

In the meantime you can use the following:

$options = @{
    Instance = 'Microsoft365';
    Collect = @('AdminPortal','ExchangeOnline','MicrosoftTeams','SharePointOnline');
    PromptBehavior = 'SelectAccount';
    IncludeEntraID = $true;
    ExportTo = @('CSV', 'HTML');
    WriteLog = $true;
    Verbose = $true;
    Debug = $true;
}
Invoke-Monkey365 @options

Could you please let me know if the above works for you?

Thanks for catching this! It's really appreciated.

Cheers,

You must be logged in to vote
1 reply
@silverhack
Comment options

Hey @roohfelix could you please check the dev branch and do let me know?

Thanks!

Comment options

@silverhack Thanks for your response.

I managed to resolve this with a workaround by editing the Initialize-MonkeyScan.ps1 script.

I replaced the following block:

$vars = [ordered]@{
    O365Object = $O365Object;
    WriteLog = $O365Object.WriteLog;
    Verbosity = $O365Object.VerboseOptions;
    InformationAction = $O365Object.InformationAction;
    VerbosePreference = $O365Object.VerboseOptions.VerbosePreference;
    DebugPreference = $O365Object.VerboseOptions.DebugPreference;
    returnData = $null;
    LogQueue = $null;
}

With this version:

$verbosePref = $null
$debugPref = $null

if ($O365Object.VerboseOptions -and ($O365Object.VerboseOptions | Get-Member -Name 'VerbosePreference' -ErrorAction SilentlyContinue)) {
    $verbosePref = $O365Object.VerboseOptions.VerbosePreference
}

if ($O365Object.VerboseOptions -and ($O365Object.VerboseOptions | Get-Member -Name 'DebugPreference' -ErrorAction SilentlyContinue)) {
    $debugPref = $O365Object.VerboseOptions.DebugPreference
}

$vars = [ordered]@{
    O365Object = $O365Object;
    WriteLog = $O365Object.WriteLog;
    Verbosity = $O365Object.VerboseOptions;
    InformationAction = $O365Object.InformationAction;
    VerbosePreference = $verbosePref;
    DebugPreference = $debugPref;
    returnData = $null;
    LogQueue = $null;
}

This avoids errors when the VerbosePreference or DebugPreference properties are missing.

Thanks again!

You must be logged in to vote
1 reply
@silverhack
Comment options

Hey @roohfelix that's great and very elegant! I'll add this to the main code base and will be updated soon.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.