GAM / Powershell Script?

4,518 views
Skip to first unread message

Chris Rollison

unread,
Sep 10, 2014, 9:16:29 AM9/10/14
to google-ap...@googlegroups.com
I set all my students with static passwords so the Active Directory sync tool doesn't do me any good since you have to change your password in order for it to grab the password.  I was wondering if anyone has come up with a decent script that would send a powershell command and gam command to create a user in both AD and Google Apps?  I really wish I was better at scripting but I think this would be handy.  Thanks.

Michael Robertson

unread,
Sep 10, 2014, 7:35:28 PM9/10/14
to google-ap...@googlegroups.com
Chris,

Do you have a database storing all the new user information?  

The commands you would be using are basically:

--

New-Aduser -Name "FirstName LastName" -GivenName "FirstName" -Displayname "FirstName LastName" -Surname "LastName -UserPrincipalName "User...@Domain.com" -SamAccountName "Username" -Office "OfficeName" -HomeDrive "HomeDriveLetter" -HomeDirectory "\\UserHomeDirectoryPath" -Type "iNetOrgPerson" -Manager "UserManager -Company "CompanyName" .......etc

& C:\Gamdirectory\Gamexecutable create user "Username" firstname "Firstname" lastname "lastname" password "password

---

As far as a script to do this.  I have one I created for my organization that reads all the information out of our company's product and then populates GAM and Powershell to use the above commands.

Toby Williams

unread,
Sep 18, 2014, 1:01:41 PM9/18/14
to google-ap...@googlegroups.com
You could also import user information from a csv file and iterate through the list with foreach.

Chris Rollison

unread,
Sep 18, 2014, 1:04:29 PM9/18/14
to google-ap...@googlegroups.com
Really what I was looking for is a direct input.  Create a script that would prompt for information for new students.  Enter a couple fields and it would create the user in both systems.

Thanks for the ideas though.

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/eb6a4c9d-16ea-4b75-8c09-3220ad78c430%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
_________________________________________________________________________

****NOTE MY EMAIL ADDRESS HAS CHANGED****
Chris Rollison
Technology Coordinator
Marceline R-V School District

Toby Williams

unread,
Sep 18, 2014, 1:22:00 PM9/18/14
to google-ap...@googlegroups.com
Well if you just want to enter data at the console then you can just put something like this in a script:

$FirstName = Read-Host  "Enter first name"
$LastName = Read-Host  "Enter last name"
$UserName = Read-Host  "Enter username"

Etc, etc.

Then when you get to executing the commands you just need to set the values to the relevant variables.

New-Aduser -Name $firstname $lastname -GivenName "$FirstName" -Displayname "$FirstName $LastName" -Surname $LastName

& C:\Gamdirectory\Gamexecutable create user $Username firstname $Firstname lastname $lastname password $password


I've been meaning to do something similar myself. I've not tested the above but it will work.


On Thursday, 18 September 2014 18:04:29 UTC+1, Chris Rollison wrote:
Really what I was looking for is a direct input.  Create a script that would prompt for information for new students.  Enter a couple fields and it would create the user in both systems.

Thanks for the ideas though.
On Thu, Sep 18, 2014 at 12:01 PM, Toby Williams <toby.buen...@gmail.com> wrote:
You could also import user information from a csv file and iterate through the list with foreach.

On Thursday, 11 September 2014 00:35:28 UTC+1, Michael Robertson wrote:
Chris,

Do you have a database storing all the new user information?  

The commands you would be using are basically:

--

New-Aduser -Name "FirstName LastName" -GivenName "FirstName" -Displayname "FirstName LastName" -Surname "LastName -UserPrincipalName "User...@Domain.com" -SamAccountName "Username" -Office "OfficeName" -HomeDrive "HomeDriveLetter" -HomeDirectory "\\UserHomeDirectoryPath" -Type "iNetOrgPerson" -Manager "UserManager -Company "CompanyName" .......etc

& C:\Gamdirectory\Gamexecutable create user "Username" firstname "Firstname" lastname "lastname" password "password

---

As far as a script to do this.  I have one I created for my organization that reads all the information out of our company's product and then populates GAM and Powershell to use the above commands.

On Wednesday, September 10, 2014 6:16:29 AM UTC-7, Chris Rollison wrote:
I set all my students with static passwords so the Active Directory sync tool doesn't do me any good since you have to change your password in order for it to grab the password.  I was wondering if anyone has come up with a decent script that would send a powershell command and gam command to create a user in both AD and Google Apps?  I really wish I was better at scripting but I think this would be handy.  Thanks.

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.

Chris Rollison

unread,
Sep 18, 2014, 1:48:32 PM9/18/14
to google-ap...@googlegroups.com
Great, thanks for the info to get me started.  Going to have to get this going.

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.

Toby Williams

unread,
Sep 19, 2014, 10:37:23 AM9/19/14
to google-ap...@googlegroups.com
No worries. This actually spurred me on to make my own function for creating new user accounts. I will share what I have once I finish.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsubscribe...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.



--
_________________________________________________________________________

****NOTE MY EMAIL ADDRESS HAS CHANGED****
Chris Rollison
Technology Coordinator
Marceline R-V School District

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.

Richard Kalk

unread,
Sep 19, 2014, 2:34:47 PM9/19/14
to google-ap...@googlegroups.com
If you are using GADS for creating users in Google Apps, You can put a static password in an unused AD attribute of some sort, like the division attribute, and setup GADS to grab that password, it will create the user with that default password.  You can also set the sync to force a password change. 

PatrickR

unread,
Mar 20, 2015, 8:21:31 AM3/20/15
to google-ap...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages