Windows Server 2008R2以降はActive Directoryをインストールすると、「Windows Powershell用のActive Directoryモジュール」という機能が追加されています。
この機能により、PowerShellを利用してActiveDirectoryを管理することが出来ます。
ADユーザーの大量登録をPowerShellを使って自動化・・・という使い方ができるでしょう。
PS C:\Users\Administrator.AD1.000> Import-Module ActiveDirectory
まずはpowershell用のプロンプトを呼び出し、モジュールを読み込みます。
cd AD→cd "(ドメイン名)"で目的のドメインにたどり着くことができます。
まるでファイルシステムを扱っているようです。
dirコマンドでオブジェクトの一覧を表示
「ActiveDirectoryユーザーとコンピューター」と同じ画面ですね
PS AD:\dc=contoso,dc=com> New-ADOrganizationalUnit "ExampleEmployees"
New-ADOrganizationalUnitで新しいOUを追加
この機能により、PowerShellを利用してActiveDirectoryを管理することが出来ます。
ADユーザーの大量登録をPowerShellを使って自動化・・・という使い方ができるでしょう。
PS C:\Users\Administrator.AD1.000> Import-Module ActiveDirectory
まずはpowershell用のプロンプトを呼び出し、モジュールを読み込みます。
PS C:\Users\Administrator.AD1.000> CD AD:
PS AD:\> cd "dc=contoso,dc=com"
cd AD→cd "(ドメイン名)"で目的のドメインにたどり着くことができます。
まるでファイルシステムを扱っているようです。
PS AD:\dc=contoso,dc=com> dir
Name ObjectClass DistinguishedName
---- ----------- -----------------
Builtin builtinDomain CN=Builtin,DC=contoso,DC=com
Computers container CN=Computers,DC=contoso,DC=com
Domain Controllers organizationalUnit OU=Domain Controllers,DC=contoso,DC=com
ForeignSecurityPr... container CN=ForeignSecurityPrincipals,DC=contoso,DC=com
Infrastructure infrastructureUpdate CN=Infrastructure,DC=contoso,DC=com
LostAndFound lostAndFound CN=LostAndFound,DC=contoso,DC=com
Managed Service A... container CN=Managed Service Accounts,DC=contoso,DC=com
NTDS Quotas msDS-QuotaContainer CN=NTDS Quotas,DC=contoso,DC=com
Program Data container CN=Program Data,DC=contoso,DC=com
System container CN=System,DC=contoso,DC=com
Users container CN=Users,DC=contoso,DC=com
dirコマンドでオブジェクトの一覧を表示
「ActiveDirectoryユーザーとコンピューター」と同じ画面ですね
PS AD:\dc=contoso,dc=com> New-ADOrganizationalUnit "ExampleEmployees"
New-ADOrganizationalUnitで新しいOUを追加
PS AD:\dc=contoso,dc=com> dir
Name ObjectClass DistinguishedName
---- ----------- -----------------
Builtin builtinDomain CN=Builtin,DC=contoso,DC=com
Computers container CN=Computers,DC=contoso,DC=com
Domain Controllers organizationalUnit OU=Domain Controllers,DC=contoso,DC=com
ExampleEmployees organizationalUnit OU=ExampleEmployees,DC=contoso,DC=com
ForeignSecurityPr... container CN=ForeignSecurityPrincipals,DC=contoso,DC=com
Infrastructure infrastructureUpdate CN=Infrastructure,DC=contoso,DC=com
LostAndFound lostAndFound CN=LostAndFound,DC=contoso,DC=com
Managed Service A... container CN=Managed Service Accounts,DC=contoso,DC=com
NTDS Quotas msDS-QuotaContainer CN=NTDS Quotas,DC=contoso,DC=com
Program Data container CN=Program Data,DC=contoso,DC=com
System container CN=System,DC=contoso,DC=com
Users container CN=Users,DC=contoso,DC=com
ちゃんと追加されました。Windows Server 2008 R2 に追加された Active Directory ドメイン サービスの新機能: Active Directory PowerShell
コメント