我正在寻找一种从Office 365租户中导出用户列表的方法。
我尝试过如下操作:
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"
我想要的输出:
"FirstName","LastName","UserPrincipalName","Licenses","Proxyaddresses"
"mailbox",,"mailbox@domain.onmicrosoft.com","aksigorta365:STANDARDPACK","mailbox2@domain.onmicrosoft.com"