We found some interesting behavior when EnableErrorReporting is enabled on the Connect-ExchangeOnline command in EXOV2.
Without:
Connect-ExchangeOnline
Get-Mailbox $testMailbox
Get-MailboxPermission $testMailbox
These commands work as you would expect. The first positional parameter is treated as the identity to be retrieved.
With EnableErrorRecording:
Connect-ExchangeOnline -ShowProgress $false -EnableErrorReporting -LogDirectoryPath 'C:\temp\ConnectExchangeOnline.log'
Get-Mailbox $testMailbox
The Get-Mailbox command returns this error:
TerminatingError(Invoke-Command): "Cannot bind parameter 'ErrorAction'. Cannot convert value "jblack-o365" to type "System.Management.Automation.ActionPreference". Error: "Unable to match the identifier name jblack-o365 to a valid enumerator name. Specify one of the following enumerator names and try again:
SilentlyContinue, Stop, Continue, Inquire, Ignore, Suspend""
Get-Mailbox $testMailbox -ErrorAction Stop
Adding an explicit ErrorAction parameter returns info for 1000 mailboxes, ignoring the identity positional parameter.
Get-Mailbox -Identity $testMailbox
Adding an Identity parameter gives the expected results.
Other examples:
Get-MailboxPermission $testMailbox
TerminatingError(Invoke-Command): "Cannot bind parameter 'ErrorAction'. Cannot convert value "jblack-o365" to type "System.Management.Automation.ActionPreference". Error: "Unable to match the identifier name jblack-o365 to a valid enumerator name. Specify one of the following enumerator names and try again:
SilentlyContinue, Stop, Continue, Inquire, Ignore, Suspend""
Get-MailboxPermission $testMailbox -ErrorAction Stop
cmdlet Get-MailboxPermission at command pipeline position 1
Supply values for the following parameters:
Identity: