雑記+備忘録

OS中心の技術情報と趣味について(最近は主に将棋)。備忘録なのでここに書かれたことを試すのは自己責任でお願いします。

ドメインユーザーをコマンドで追加(dsadd user)

例:ユーザーアカウント「testUser」をOU「TestOU」内にグループ「testGroup」に所属した状態で作成する
ドメイン名は「test.local」

dsadd user "CN=testUser,OU=TestOU,DC=test,DC=local" -upn testUser@test.local -fn 太郎 -ln 山田 -display "山田 太郎" -pwd Hoge5678 -memberof "CN=testGroup,OU=TestOU,DC=test,DC=local" -pwdneverexpires yes

主なオプションの説明(上記例文では入れていないものも含む)

-upn
プロパティのユーザー表示名

-fn
名前(first name)
-ln
苗字(last name)
-display
表示名

-mustchpwd {yes | no}
ユーザーは次回ログオン時にパスワードを変更しなければならない
既定値はno

-canchpwd {yes | no}
ユーザーがパスワードを変更できる
-mustchpwdがyesの場合は自動的にyes。既定値はyes

-pwdneverexpires {yes | no}
ユーザーのパスワードを無期限にする
既定値はyes

-disabled {yes | no}
ユーザーアカウントを無効にする
既定値はno