1

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 
2
  • Hi Yannick, how far did you get with this? Commented Jul 14, 2017 at 18:17
  • In order to work, you have to open session with azure AD and import session in exchange before running the script. The get-user command is only valid in exchange. out of that, the script work perfectly. Commented Jul 17, 2017 at 17:28

1 Answer 1

4

By default commands like Get-User and Get-MSOLUser only give you the first 200 objects. you have -ALL next to the Get-MSOLUser command but not next to the GET-USER cmdlet. try using Get-USER -ALL

Hope This Works,

Mike

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.