教えて!HELPDESK

Excel   Word  Outlook  PowerPoint   Windows

  

AD PowerShell:ユーザーの特定の属性を調べる(Get-ADUser -Identity UserID -Properties 属性 | Select-Object 属性)

 

■ PowerShellでユーザーの全属性を調べる

Get-ADUser -Identity UserID -Properties *

 

■ PowerShellでユーザーの特定の属性を調べる

Get-ADUser -Identity UserID -Properties 属性 | Select-Object 属性

 

例:表示名を調べる

Get-ADUser -Identity ho_yamada -Properties DisplayName | Select-Object DisplayName

↓結果↓

DisplayName
-----------
yamada hiromi

 

例:全般-電話番号-その他 を調べる

Get-ADUser -Identity ho_yamada -Properties otherTelephone | Select-Object otherTelephone

↓結果↓

otherTelephone
--------------
{49494949}

 

■ 複数の属性を返す場合(, で属性をつなげる)

Get-ADUser -Identity UserID -Properties 属性, 属性, 属性 | Select-Object 属性, 属性, 属性

 

例:名前・表示名・イニシャルを返す

Get-ADUser -Identity ho_yamada -Properties Name, DisplayName, Initials | Select-Object Name, DisplayName, Initials


■ 属性名を調べるには

Get-ADUser -Identity UserID -Properties *

 

例:Get-ADUser -Identity ho_yamada -Properties *
上記で全てのADプロパティの値を出力できるので、属性名が不明な場合は適当な値を格納してから上記PSで確認すると早い場合があります。例えば、全般タブ→「電話番号」→「その他」といった一見分かりづらい属性名などがすぐに見分けがつきます。

 

■ 属性名一覧

https://learn.microsoft.com/en-us/powershell/module/activedirectory/set-aduser?view=windowsserver2025-ps

  

 

教えて!HELPDESK

Excel   Word  Outlook  PowerPoint   Windows