GAM的Powershell脚本
因此,我正在制作一个脚本来创建包括G Suite在内的新用户。我想使用gam做到这一点。我被授权运行GAM命令,当我手动运行它们时,它确实可以工作。但是,看来在脚本中进行操作时,我有身份验证问题。我收到错误400:无效密码。起初,我认为这是Create用户命令的无效,但是经过一番故障排除,似乎更多,因此我没有对Google进行认证。任何人都有任何想法吗???
$firstname = Read-Host -Prompt 'Input first name'
$lastname = Read-Host -Prompt 'Input last name'
$username = $firstname.ToLower()+"."+$lastname.ToLower()
$email = $username+'@archiactvr.com'
$recovery = Read-Host -Prompt 'What is the recovery email address'
gam create user $email firstname $firstname lastname $lastname changepassword on sha recoveryemail $recovery
gam update group [email protected] add member user $email
So I'm making a script for creating new users which includes G Suite. I'm wanting to use gam to do this. I am authorized for running gam commands and it does appear to work when I run them manually. However, it appears that when doing it in a script, I'm having authentication issues. I get an error 400: invalid password. At first I thought it was an invalid one for the create user command, but after some troubleshooting, it appears to be more so that I am not authenticated to google. Anyone have any ideas???
$firstname = Read-Host -Prompt 'Input first name'
$lastname = Read-Host -Prompt 'Input last name'
$username = $firstname.ToLower()+"."+$lastname.ToLower()
$email = $username+'@archiactvr.com'
$recovery = Read-Host -Prompt 'What is the recovery email address'
gam create user $email firstname $firstname lastname $lastname changepassword on sha recoveryemail $recovery
gam update group [email protected] add member user $email
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然需要组织。错过了!添加组织 /修复。由于我没有通过密码,还删除了SHA。
The org is apparently required. Missed that! adding org / fixed it. Also removed the sha since I'm not passing a password through.