SpanningCloudApps / SB365-Powershell

Spanning Backup for Office 365 REST API PowerShell Module
https://spanning.com
Apache License 2.0
11 stars 5 forks source link

Issue retreiving users #62

Closed mertserger closed 2 years ago

mertserger commented 2 years ago

Hi,

I know this has been brought up before but I have tried the suggested methods and nothing seems to work. I am having real trouble retrieving the list of assigned users from the API. It keeps stopping at random points but I have not managed to get a complete list yet.

This is most likely due to the size of our account but not sure. I have tried setting the -size property to the following, 20, 50, 250, 500 and 1000. With the 1000 getting the best result but still not complete. The most it has ever returned is about 3000 users.

Also tried using -UserType ALL and just ASSIGNED.

Licensed users is around 8900 and total user count is about 158,000

Any ideas?

PS: With -Verbose running it is not showing any errors so don't think it is a time out issue.

SPMatthewMcD commented 2 years ago

The -size parameter only changes the page size of the results. It does not affect the size of the result. Normally, you should not need to change it. If you are using PowerShell 5 there is an issue with the time it takes for PowerShell to resolve the JSON in our Status, so if you don't need Status I would leave that off.

Returning 158,000 users will take some time. We return 1000 per request. In Verbose mode you should see each of the 159 requests. Your best option is to assign the result to a variable so that you only have to populate the variable one time. Something like this:

$users = Get-SpanningUser -UserType All -Verbose

Once the process completes you can use the $users variable for your processing.

mertserger commented 2 years ago

I have tried this query but it will still not complete. It just stops at a random time with a random number of results. I think the most I have ever been able to retrieve is about 5000 ish. Never any more than that. with the -verbose it shows no errors just stops.

SPMatthewMcD commented 2 years ago

That shouldn't happen. Please file a support ticket so the team can investigate.

Alternatively, you can send me your API key and user to my company email (matt.mcdermott@spanning.com) and I can try it. This would rule out any errors or issues on your end.

Please DO NOT post the key here. Once I am done testing you can revoke the key.

SPMatthewMcD commented 2 years ago

Please reopen if you are still having issues.