我从这篇文章中拿出了这个脚本: Office 365 Powershell,但是当我运行它时,我收到这个错误:
警告:更多结果可用。 请指定All或MaxResults参数之一。
我需要在哪里添加maxresults参数才能使导出成为可能?
$lines = @() foreach($msolUser in (Get-MSOLUser -ALL | where {$_.isLicensed -eq $true})) { $UserInfo = Get-User -identity $msolUser.UserPrincipalName foreach($license in $msolUser.Licenses) { $lines += New-Object PsObject -Property @{ "Nom/Prenom"="$($UserInfo.DisplayName)"; "Societe"="$($UserInfo.Company)"; "AdressePrincipale"="$($UserInfo.UserPrincipalName)"; "Licences"="$($license.AccountSKUid)" } } } $lines | Export-CSV C:\out1.csv -Delimiter ";" -Encoding Unicode
默认情况下,像Get-User和Get-MSOLUser这样的命令只给你前200个对象。 您有-ALL旁边的Get-MSOLUser命令,但不在GET-USER cmdlet旁边。 尝试使用Get-USER -ALL
希望这个工作,
麦克风