【发布时间】:2019-01-24 06:22:20
【问题描述】:
我想让 ProxyAddress 具有大写 SMTP domain.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"
【问题讨论】:
-
你有没有让事情顺利进行?
标签: powershell office365 export-to-csv