Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Message Getting All Users for Multi-Domain Customer #32

Closed
ryanfog opened this issue Apr 17, 2018 · 26 comments
Closed

Error Message Getting All Users for Multi-Domain Customer #32

ryanfog opened this issue Apr 17, 2018 · 26 comments
Assignees

Comments

@ryanfog
Copy link

ryanfog commented Apr 17, 2018

When I perform a "Get-GSUser -Filter *" the expected result is to pull back all users in G-Suite, instead I get an error message. My environment has a little over 12K accounts involved.

capture

@scrthq scrthq self-assigned this Apr 25, 2018
@scrthq scrthq added the bug label Apr 25, 2018
@scrthq
Copy link
Member

scrthq commented Apr 25, 2018

Hey @ryanfog - Checking this out now! Apologies for the delay!

@scrthq
Copy link
Member

scrthq commented Apr 25, 2018

Can you try running the following to see if you get a different behavior? I have a feeling the default SearchBase value may be causing some headaches for your org size:

$users = Get-GSUser -Filter * -SearchBase $null -Verbose

This should give you some verbose feedback showing the exact filter being sent with the command. Screenshot showing the differences:

image

@scrthq
Copy link
Member

scrthq commented Apr 28, 2018

@ryanfog check my last answer and let me know if passing $null for the SearchBase parameter fixes this for you!

@scrthq
Copy link
Member

scrthq commented Apr 30, 2018

@ryanfog FYI - I removed the default value for SearchBase in v2.5.0. Still pending confirmation that this was the source of the issue for you though, let me know if either v2.5.0's update fixes you or if setting the SearchBase value to $null on an earlier version does the same!

@ryanfog
Copy link
Author

ryanfog commented May 3, 2018

Nate,

Sorry bad news same error..

image

@scrthq
Copy link
Member

scrthq commented May 3, 2018

@ryanfog - In your PSGSuite config, do you have your customer ID and domain set?

@ryanfog
Copy link
Author

ryanfog commented May 3, 2018

I do have a customer ID listed and one of the primary domains of the 40 or so we have listed in Google. if we need to do a screen share or something I am open to that

@scrthq
Copy link
Member

scrthq commented May 3, 2018

Gotcha! What's your Preference set to in your config? CustomerID or Domain or not set?

@scrthq
Copy link
Member

scrthq commented May 3, 2018

And are you trying to list the users for all domains under your customer? or just a single domain's users?

@ryanfog
Copy link
Author

ryanfog commented May 3, 2018

[Variables]
;Add all persistent or environment specific variables here
AdminEmail=account@domain.com
Preference=CustomerID
CustomerID=108427614290562006643
ConfigName=PSGSuiteConfig
Domain=domain.com
P12KeyPath=C:\Users\fogler\Documents\PSGSuite\SecertSauce.p12
AppEmail=powershell@psgsuite-197900.iam.gserviceaccount.com
ServiceAccountClientID=308d85bab6e33c25fed6103225f6e2e2481e320d

@ryanfog
Copy link
Author

ryanfog commented May 3, 2018

All users and all domains

@scrthq
Copy link
Member

scrthq commented May 3, 2018

can you try setting your CustomerID to "my_customer" as a test, then rerunning to see if any difference is made?

# Save the current customer ID
$currentCustomerID = (Show-PSGSuiteConfig).CustomerID

# Set the config to use the generic my_customer value
Set-PSGSuiteConfig -CustomerID my_customer

# Try pulling users again (Verbose may show where it's hanging)
$users = Get-GSUser -Filter * -Verbose

# Revert your config back to normal
Set-PSGSuiteConfig -CustomerID $currentCustomerID 

@scrthq
Copy link
Member

scrthq commented May 3, 2018

if the above works, then it may indicate the wrong CustomerID is stored in your config OR that Google really doesn't like using the CustomerID there and prefers my_customer instead.

Next step would be to ensure that the customer ID wasn't the result of an odd copy/paste or something via this command to pull your admin user account and the customer ID property directly from there:

Set-PSGSuiteConfig -CustomerID (Get-GSUser).CustomerID

@ryanfog
Copy link
Author

ryanfog commented May 3, 2018

Its appears you are onto something..

@scrthq
Copy link
Member

scrthq commented May 3, 2018

side note - I think that you should be able to specify a domain as well to list all users from, as currently Get-GSUserListPrivate only allows pulling the full customer list OR the domain set in the config (if Preference is set to Domain)

@scrthq
Copy link
Member

scrthq commented May 3, 2018

Sweet!!!

Try running the command in my previous message to set your CustomerID directly from the value returned by Get-GSUser for your AdminEmail:

Set-PSGSuiteConfig -CustomerID (Get-GSUser).CustomerID
$users = Get-GSUser -Filter * -Verbose

@scrthq
Copy link
Member

scrthq commented May 3, 2018

PS - I removed your screenshot since you still had your adminemail showing on the second verbose output 😉

@ryanfog
Copy link
Author

ryanfog commented May 3, 2018

Consider this issue resolved, it appears to be the old ID10T error on my part.

@scrthq
Copy link
Member

scrthq commented May 3, 2018

lol, you're good! no dumb moves, just continual learning experiences. Glad it's sorted!!

I'm still going to add some updates to Get-GSUser to allow specific domain listing as well, as I'm sure it will be useful for users like you who manage multiple G Suite domains!

@scrthq scrthq changed the title Error Message Getting All Users Error Message Getting All Users for Multi-Domain Customer May 3, 2018
@ryanfog
Copy link
Author

ryanfog commented May 3, 2018

That would be awesome this we are a global company with domains like domain.fr and domain.ca etc..

@scrthq
Copy link
Member

scrthq commented May 3, 2018

I should have an updated version that adds that functionality in by tonight!

@scrthq
Copy link
Member

scrthq commented May 3, 2018

Just to confirm as well, you were good after setting the CustomerID in your config to (Get-GSUser).CustomerID still, right @ryanfog ?

@scrthq
Copy link
Member

scrthq commented May 3, 2018

you should be using the actual CustomerID in your config and not the my_customer value if you can avoid it, just want to make sure it's working once set exactly still

@ryanfog
Copy link
Author

ryanfog commented May 3, 2018

That is correct my config.ini file is updated with the proper customerID retrieved from Google directly.

@scrthq
Copy link
Member

scrthq commented May 3, 2018

sweet! glad it's sorted!

@scrthq scrthq closed this as completed in #41 May 4, 2018
scrthq added a commit that referenced this issue May 4, 2018
## 2.5.3

* Fixed/Added: Specific domain support for listing users with `Get-GSUser -Filter $filter -Domain domain2.com` to allow customers with multiple domains to only list users for a specific domain instead of just the entire customer or domain saved in the config. (Resolve [Issue #32](#32))
* Added: Better verbose output in when listing users
* Fixed: Performance increase in `Get-GSDriveFileList` but returning DriveFile objects as it iterates through each page instead of storing in an array and returning the array at the end (Resolve [Issue #38](#38))
@scrthq
Copy link
Member

scrthq commented May 4, 2018

@ryanfog - added the ability to specify -Domain $otherDomain with v2.5.3!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants