我正在为我们的帐户管理团队准备一个脚本,它将相当快地创建用户帐户。我似乎总是有错误说:
New:属性的值不在可接受的值范围内。
我已经在网上看过了一些,但是其他人发布的一些解决方案对我没有用。守则如下:
Write-Host "New Business Services Account" -ForegroundColor Green
$Name = Read-Host "Enter First and Last Name"
$DisplayName = $Name
$GivenName = Read-Host "Enter First Name"
$Surname = Read-Host "Enter Last Name"
$EmailAddress = Read-Host "Enter Email Address"
$SamAccountName = Read-Host "Enter SamAccountName"
#$UserPrincipalName = $GivenName.$Surname + "@{entrustenergy}.com"
$Office = Read-Host "Enter Office"
$City = "Houston"
$State = "TX"
$ZipCode = Read-Host "Enter Zip Code"
$Country = "United States"
$Company = "Entrust Energy, Inc."
$JobTitle = Read-Host "Enter Job Title"
$Department = Read-Host "Enter Department"
$Manager = Read-Host "Enter Managers Username"
$Path = "PathOUisHere"
$Password = Read-Host "Enter Password"
New-ADUser -Name "$Name" -GivenName "$GivenName" -Surname "$Surname" `
-DisplayName "$DisplayName" -EmailAddress "$EmailAddress" `
-SamAccountName "$SamAccountName" -StreetAddress "$Address" -City "$City" `
-State "$State" -PostalCode "$ZipCode" -Country "$Country" `
-Company "$Company" -Title "$JobTitle" -Department "$Department `
-Manager "$Manager" -Path "$Path" -Enabled $true `
-AccountPassword (ConvertTo-SecureString "$Password" -AsPlainText -Force) `
-ChangePasswordAtLogon $true -PassThru发布于 2016-05-25 13:21:26
您正在传递'-StreetAddress“”$Address“,但是它从来没有在读-主机部分提供过。
https://stackoverflow.com/questions/37438299
复制相似问题