Created
November 21, 2013 06:44
-
-
Save TearTheSky/7577027 to your computer and use it in GitHub Desktop.
架空の会社の情シスになってActive Directoryを管理しなきゃいけなくなったので、CSVに書かれたユーザを一括で登録するスクリプトを作りました。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import-module ActiveDirectory | |
$company = 'tearthesky.com' | |
$usersOU = 'CN=Users,DC=tearthesky,DC=com' | |
write-host "Drop New Users List(CSV File)" | |
$csvFilePath = read-host | |
$newUsers = import-csv $csvFilePath | |
foreach($aUser in $newusers){ | |
$aPassword = ConvertTo-SecureString $aUser.パスワード -AsPlainText -Force | |
New-ADUser -Name $aUser.アカウント名` | |
-SamAccountName $aUser.アカウント名 ` | |
-UserPrincipalName $aUser.アカウント名 ` | |
-GivenName $aUser.名 ` | |
-Surname $aUser.姓 ` | |
-DisplayName $aUser.表示名 ` | |
-Path $usersOU ` | |
-Company $company ` | |
-Division $aUser.事業部 ` | |
-Department $aUser.部署 ` | |
-Office $aUser.勤務先 ` | |
-AccountPassword $aPassword ` | |
-ChangePasswordAtLogon $false ` | |
-Title $aUser.役職 ` | |
-Manager $aUser.上司 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment