Quantcast
Channel: iT邦幫忙 - windows
Viewing all articles
Browse latest Browse all 1185

用New-ADOrganizationalUnit 批量建立數個OU 我該如何下指令?

$
0
0
各位大大,幾個問題請問:

1. 我想用New-ADOrganizationalUnit 批量建立數個OU 我該如何下指令?

2. 我自己試過用以下指令,請好心大大幫我看看哪裡有錯!!!

$OU1 = Users
$OU2 = Taiwan
$OU3 = APAC

$path = "OU=$OU1,OU=$OU2,OU=$OU3,dc=GPO,dc=net"
$Password = convertto-securestring 'Password123' -asplaintext -force

$Filepath = "C:\GTO.csv"
$Users = Import-csv $FilePath

Foreach ($user in $Users) {

New-ADUser -AccountPassword $Password -DisPlayName $User.DisplayName -Enable $True -Name $User.DisplayName -SamAccountName $User.SamAccountName -Path $path -givenname $user.Firstname -surname $user.Lastname -UserPrincipalName $User.UserPrincipalName;

}


以下圖片,是對應的CSV檔

Viewing all articles
Browse latest Browse all 1185

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>