通过AD扩展属性为用户启用Google Workspace权限

网友投稿 569 2022-09-11

通过AD扩展属性为用户启用Google Workspace权限

通过AD扩展属性为用户启用Google Workspace权限

脚本内容:

$user = $args[0] $samacount = Get-ADUser -Filter {name -eq $user -or samaccountname -eq $user} | % {$_.SamAccountName} $attr = @{'ExtensionAttribute1' = 'GoogleGsuite'} Function check{ $checkresult = (Get-ADUser -Identity $samacount -Properties *).ExtensionAttribute1 if ($checkresult -eq 'GoogleGsuite'){ Write-Output "$user : GoogleGsuite Enable Sucessfully!" } else{ Write-Output Write-Output "$user : GoogleGsuite Enable Failure!" } } if ($samacount -eq $null){ Write-Output "$user : The username is not exist!" } else{ $attr_value = (Get-ADUser -Identity $samacount -Properties *).ExtensionAttribute1 if ($attr_value -eq 'GoogleGsuite'){ Write-Output "$user : GoogleGsuite enabled in the past!" } else{ Set-ADUser -Identity $samacount -Add $attr check } }

执行测试:

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:.NET进阶篇06-async异步、thread多线程1(rsync 多线程同步)
下一篇:检查AD账号认证失败次数并发送邮件至管理员
相关文章

 发表评论

暂时没有评论,来抢沙发吧~