Hi, I’m currently using a powershell script to get a quarantined message from Office 365 by looking searching with a string called messageId. My code works up until
Get-QuarantineMessage -MessageId $MessageID
The error I get is below
I’m unable to cast object of type
‘System.Management.Automation.PsCustomObject’ to type ‘System.Management.Automation.PsModuleInfo’
Based on your error seems that it should be set to System.Management.Automation.PsModuleInfo but sometimes it’s tricky. Sometimes whole scripts are using different arguments and you need to divide script for a separate invoked blocks where one block will trigger another one using it’s output.