Comments (5)
Hey Cooper,
With the current released version, Get-GSUser is limited to what Google get user
API call options are (which necessitate a UserId / primary email). You would need to use Get-GSUserList -Query $query
to do what you're looking to do (but it's 100% doable). You'll need to follow Google's User Search syntax for this: https://developers.google.com/admin-sdk/directory/v1/guides/search-users
Here's an example that I just tested with:
Get-GSUserList -Query "name='Nate Ferrell'"
That all being said, v2.0.0 of PSGSuite allows you to leverage Get-GSUser as a one-stop-shop to provide a level of parity with Get-ADUser -Filter $filter
if you're familiar with searching for users. Quick example of how this would be done a little closer to expected syntax with the new version:
Get-GSUser -Filter "name -eq 'Nate Ferrell'"
Cheers!
- Nate
from psgsuite.
Great, thanks for the info.
from psgsuite.
In your example, for Get-GSUserList, how can I query a user by a variable first and last name that might contain apostrophes/single quotes?
from psgsuite.
As Google requires string search values to be wrapped in single quotes/apostrophes, you need to escape any apostrophes in your search string with a backslash. You would need to do string replacement in line if you're doing it programmatically to account for this
# Searching for someone with the exact name "John O'Neal"
$name = "John O'Neal"
Get-GSUserList -Query "name='$($name.Replace("'","\'"))'"
If you're just running commands on the fly and not storing the name in a variable:
Get-GSUserList -Query "name='John O\'Neal'"
from psgsuite.
Thank you for that. I decided it was faster to download the entire user list at the start of the script and use something like:
$GSAccount = $googleAccounts | Where-Object { $_.name.fullName -eq $stud.Display }
from psgsuite.
Related Issues (20)
- You don't have sufficient permissions to use the requested API HOT 1
- Additional Reports Since Last Edited HOT 1
- Send-GmailMessage: Special characters not displayed as expected in HTML Body HOT 1
- Inconsistent Get-GSUser "IsEnrolledIn2Sv" field results when multiple users are returned HOT 1
- Update-GSChromeOSDevice - Wipe devices User Profile Only HOT 6
- PowerShell Constrained Language mode HOT 1
- Setup Guide Unclear / Not up to Date HOT 5
- Dynamically Generating Functions for Slide/Doc/Sheet updates
- Create Documents and Presentations
- 2.37.0 release is too big for Azure Automation
- Add option to enable conversation history HOT 1
- Licensing Data out of date HOT 4
- Still being developed?
- Add Last Known Network to Get-GSChromeOSDevice HOT 8
- Get-GSGmailSignature ... Update-GSGmailSignature HOT 1
- Update-GSUser support for unarchiving HOT 2
- Update-GSUserSecuritySettings -User User -AllowLessSecureApps -$True
- Set group labels via CloudIdentity API
- I am getting error in gsuite assement
- Initial Setup Instructions Need Updating (Here's what worked for me) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psgsuite.