Hey Group,
I'm working on creating a single page form using powershell to create a user and assign that user to groups on our Gsuite domain using GAM. Our usernames consist of Firstname.Lastname. The problem is that GAM is not liking the input variables. Here's a snippet of the code I'm working with.
Function button2_RunOnClick()
{
pushd F:\Gam
#gam create user $textBox1'.'$textBox2 firstname $textBox1 lastname "$textBox2" password "RunForestRun!" changepassword off
if ($checkBox1.Checked) {gam update group test...@mydomain.edu add member user $textBox1'.'$textBox2@mydomain.edu}
}
If I change the variables to the username Bubba.Gump I can get it to add the group to the user. If I leave the variables I receive the error.
gam : adding member System.Windows.Forms.TextBox, Text: Bubba.System.Windows.Forms.TextBox, Text: Gu...@mydomain.edu...
At F:\GAM\NewEmployeeGmail1.ps1:165 char:30
+ ... 1.Checked) {gam update group test...@mydomain.edu add member u ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( adding member ...rcollege.edu...:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
ERROR: 400: Invalid Input: memberKey - invalid
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/554ec667-16a1-4d83-b9b2-eead1b6421d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nick,PowerShell is strange about quoting, try:
if ($checkBox1.Checked) {gam update group test...@mydomain.edu add member user """$textBox1.$text...@mydomain.edu"""}
Triple double quotes are magic.Ross
On Fri, Aug 11, 2017 at 8:15 AM, Nick M. <nick.m...@gmail.com> wrote:
Hey Group,
I'm working on creating a single page form using powershell to create a user and assign that user to groups on our Gsuite domain using GAM. Our usernames consist of Firstname.Lastname. The problem is that GAM is not liking the input variables. Here's a snippet of the code I'm working with.
Function button2_RunOnClick()
{
pushd F:\Gam
#gam create user $textBox1'.'$textBox2 firstname $textBox1 lastname "$textBox2" password "RunForestRun!" changepassword off
if ($checkBox1.Checked) {gam update group test...@mydomain.edu add member user $textBox1'.'$text...@mydomain.edu}
}
If I change the variables to the username Bubba.Gump I can get it to add the group to the user. If I leave the variables I receive the error.
gam : adding member System.Windows.Forms.TextBox, Text: Bubba.System.Windows.Forms.TextBox, Text: Gu...@mydomain.edu...
At F:\GAM\NewEmployeeGmail1.ps1:165 char:30
+ ... 1.Checked) {gam update group test...@mydomain.edu add member u ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( adding member ...rcollege.edu...:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
ERROR: 400: Invalid Input: memberKey - invalid
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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 https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/554ec667-16a1-4d83-b9b2-eead1b6421d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.