Я хочу получить пользователей, у которых ProxyAddress имеет формат SMTP домена.onmicrosoft.com и / или domain.mail.onmicrosoft.com в верхнем регистре.
Сообщение об ошибке:
At line:1 char:218
+ ... pression={[string]::join(“;”, ($_.Licenses))} -ExpandProperty Proxyad ...
+ ~~~~~~~~~~~~~~~
Unexpected token '-ExpandProperty' in expression or statement.
At line:1 char:234
+ ... ng]::join(“;”, ($_.Licenses))} -ExpandProperty Proxyaddresses | ? {$_ ...
+ ~~~~~~~~~~~~~~
Unexpected token 'Proxyaddresses' in expression or statement.
At line:1 char:233
+ ... pression={[string]::join(“;”, ($_.Licenses))} -ExpandProperty Proxyad ...
+ ~
The hash literal was incomplete.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
Я пробовал, как показано ниже:
Get-MSOLUser -All | Where-Object {$_.IsLicensed -eq $true -and $_.BlockCredential -eq $false} | Select-Object FirstName, LastName, UserPrincipalName, @{Name=’Licenses’;Expression={[string]::join(“;”, ($_.Licenses))} -Expand Proxyaddresses | ? {$_ -cmatch '^SMTP\:.*@domain.onmicrosoft.com'} | Export-Csv C:\Users\Admin\Desktop\Userlist.csv
Обновление:
#TYPE System.String
"FirstName","LastName","UserPrincipalName","Licenses","Length"
"mailbox2",,"mailbox2@domain.onmicrosoft.com","Microsoft.Online.Administration.UserLicense","48"