I took this script from that post : Office 365 Powershell
but when I run it, I receive that error :
WARNING: More results are available. Please specify one of the All or
MaxResults parameters.
Where do I need to add the maxresults parameters in order to make the export possible?
$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
Best Answer
By default commands like
Get-User
andGet-MSOLUser
only give you the first 200 objects. you have-ALL
next to theGet-MSOLUser
command but not next to theGET-USER
cmdlet. try usingGet-USER -ALL
Hope This Works,
Mike