달력

1

« 2025/1 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
2011. 11. 1. 16:10

PowerShell을 이용한 AD 계정 생성 셈플 Etc.2011. 11. 1. 16:10

PowerShell을 이용한 AD 계정 생성 셈플
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."
}

:
Posted by 커널64