Adding Organizational Unit In Domain with PowerShell Command
Copy the following command in Notepad:
$basedn = "ou=Test,dc=yourdomain,dc=com"
New-ADOrganizationalUnit -Name "Test1" -Path $basedn ProtectedFromAccidentalDeletion $false
New-ADOrganizationalUnit -Name "Test2" -Path $basedn -ProtectedFromAccidentalDeletion $false
New-ADOrganizationalUnit -Name "Test3" -Path $basedn -ProtectedFromAccidentalDeletion $false
Note: Suppose your ou name "Employee" and your domain name is yourdomain.com.au. Edit it like "ou=Employee,dc=yourdomain,dc=com,dc=au". Test1, Test2, Test3 are tree OU.
Now Save the file as "test OU.ps1".
Right click on the file and click on "Run as PowerShell".
$basedn = "ou=Test,dc=yourdomain,dc=com"
New-ADOrganizationalUnit -Name "Test1" -Path $basedn ProtectedFromAccidentalDeletion $false
New-ADOrganizationalUnit -Name "Test2" -Path $basedn -ProtectedFromAccidentalDeletion $false
New-ADOrganizationalUnit -Name "Test3" -Path $basedn -ProtectedFromAccidentalDeletion $false
Note: Suppose your ou name "Employee" and your domain name is yourdomain.com.au. Edit it like "ou=Employee,dc=yourdomain,dc=com,dc=au". Test1, Test2, Test3 are tree OU.
Now Save the file as "test OU.ps1".
Right click on the file and click on "Run as PowerShell".
Type Y and press Enter.
Now you can see the desired OU in Active Directory Users and Computers.
Comments
Post a Comment