workflow Test-ExchangeQuery {
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
Param
(
# Username of account
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
[string[]]
$Identity,
# Exchange/AD Credentials
[Parameter(Mandatory=$true)]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
$Credential
)
Set-PSWorkFlowData -PSAllowRedirection $true
ForEach -Parallel -ThrottleLimit (2) ($user in $Identity) {
InlineScript {
Get-Mailbox -Identity $using:user | Select-Object Name, PrimarySmtpAddress
} -DisplayName "Querying Exchange" `
-PSCredential $Credential `
-PSConnectionUri "https://ps.outlook.com/powershell/" `
-PSConfigurationName "Microsoft.Exchange" `
-PSComputerName $null `
-PSAuthentication Basic `
-PSConnectionRetryCount 3 `
}
}