2011. 11. 1. 16:10
PowerShell을 이용한 AD 계정 생성 셈플 Etc.2011. 11. 1. 16:10
PowerShell을 이용한 AD 계정 생성 셈플
PowerShell Script Create Active Directory User
먼저, 모듈 가져온 후,
Import-Module activedirectory
스크립트 실행
PowerShell Script Create Active Directory User
먼저, 모듈 가져온 후,
Import-Module activedirectory
스크립트 실행
$SAMAccountName = "Hong"
$DomainSuffix = "msft.local"
$InitialPassword = "P@ssw0rd"
$Surname = "홍"
$GivenName = "길동"
$Description = "총무팀 관리자"
$Path = "OU=users,OU=msft corporation,DC=msft,DC=local"
Try
{
New-ADUser -SamAccountName $SAMAccountName -UserPrincipalName $SAMAccountName"@"$DomainSuffix -AccountPassword (ConvertTo-SecureString -AsPlainText $InitialPassword -Force) -Enabled $True -PasswordNeverExpires $True -Path $Path -Surname $Surname -GivenName $GivenName -Name ($Surname + " " + $GivenName) -DisplayName ($Surname + " " + $GivenName) -Description $Description
}
Catch
{
Write-Host "AD User Creation Failed."
}