Skip to content

Instantly share code, notes, and snippets.

@nikuyoshi
Created January 8, 2016 17:14
Show Gist options
  • Save nikuyoshi/e4416f7b8783c22b8c95 to your computer and use it in GitHub Desktop.
Save nikuyoshi/e4416f7b8783c22b8c95 to your computer and use it in GitHub Desktop.
Active Directory Service Interface(ADSI)を使用したプライマリグループの変更 ref: http://qiita.com/nikuyoshi/items/0a9d6bc47de81ae7b5eb
$primaryGroup = [adsi]"LDAP://CN=group1,OU=ou1,dc=hoge,dc=local"
$primaryGroup.GetInfoEx(@("primaryGroupToken"), 0)
$primaryGroupToken = $primaryGroup.Get("primaryGroupToken");
$user = [adsi]("LDAP://CN=user1,OU=ou1,dc=hoge,dc=local")
$user.Put("primaryGroupId", $primaryGroupToken)
$user.SetInfo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment