トップ回答者
PowerShellでADユーザのプロパティを変更する際「-Identity」の後に記述するものは?

質問
-
下記のように、PowerShellでADのユーザのプロパティ(例:メールアドレス)を変更する場合ですが、-Identityの後の[xxxxx]に指定するのは、samAccountName」でしょうか。ネットで調べると他に、UPN等いろいろあるように思えるのですが。
Set-ADUser -Identity [xxxxx] -EmailAddress "xxxxx@xxxx.com"
ご存知の方、教えて頂けますでしょうか。
回答
すべての返信
-
チャブーンです。
やきさんの回答でまったく問題はないのですが、どうでもいい補足をさせてください。
-Identityオプションは(おそらく本来論としては)「オブジェクト本体」を直接指定することを想定しているという理解です。実際に以下のリファレンスにもありますが、直接オブジェクトを指定することができます。
https://technet.microsoft.com/en-us/library/ee617215.aspx
----
The Identity parameter specifies the Active Directory user to modify. You can identify a user by its distinguished name (DN), GUID, security identifier (SID) or Security Accounts Manager (SAM) account name. You can also set the Identity parameter to an object variable such as $<localUserObject>, or you can pass an object through the pipeline to the Identity parameter. For example, you can use the Get-ADUser cmdlet to retrieve a user object and then pass the object through the pipeline to the Set-ADUser cmdlet.
----Set-ADUser -Identity (Get-ADUSer <Name>) -EmailAddress "xxxxx@xxxx.com"
一見面倒なようですが、この仕様になっているからこそ、パイプラインによる代入が可能になっています。
フォーラムは有償サポートとは異なる「コミュニティ」です。フォーラムでご質問頂くにあたっての注意点 をご一読のうえ、お楽しみください。