用于创建 AD 用户的系统管理器 PowerShell 命令

问题描述 投票:0回答:1

我正在尝试运行 PowerShell 命令在 EC2 实例之一托管的活动目录中创建广告用户。

New-ADUser -Name 'Batman Gotham' -AccountPassword (ConvertTo-SecureString 'Password@1234' -AsPlainText -Force) -DisplayName 'Batman Gotham' -GivenName 'Batman' -SamAccountName '[email protected]' -Surname 'Gotham' -EmailAddress '[email protected]' -UserPrincipalName '[email protected]' -MobilePhone '8888888888' -Title 'Staff Super Hero' -Department 'Batman Cloud Services' -Enabled $True -StreetAddress 'Gotham Street' -City 'Gotham' -State 'CA' -Country 'USA' -Path 'CN=Users,OU=Operations,DC=darknight,DC=com' -employeeNumber '1234567' -ChangePasswordAtLogon $True

但是我在系统管理器中收到以下错误,并且无法找到有关该错误的更多详细信息:

New-ADUser : The name provided is not a properly formed account name
At C:\ProgramData\Amazon\SSM\InstanceData\i-instanceid\document\orchestr
ation\853f5c41-fcbf-44e0-b7fb-qwe1234redfdd\awsrunPowerShellScript\0.awsrunPower
ShellScript\_script.ps1:1 char:1
+ New-ADUser -Name 'Batman Gotham' -AccountPassword (ConvertTo-SecureString 
'Passw ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (CN=Batman Gotha...darknight,DC=com 
   :String) [New-ADUser], ADException
    + FullyQualifiedErrorId : ActiveDirectoryServer:1315,Microsoft.ActiveDirec 
   tory.Management.Commands.NewADUser

有人以前见过这个问题吗?

python powershell lambda aws-ssm
1个回答
0
投票

更新 SamAccountName 解决了该问题

New-ADUser -Name 'Batman Gotham' -AccountPassword (ConvertTo-SecureString 'Password@1234' -AsPlainText -Force) -DisplayName 'Batman Gotham' -GivenName 'Batman' -SamAccountName 'batman.gotham' -Surname 'Gotham' -EmailAddress '[email protected]' -UserPrincipalName '[email protected]' -MobilePhone '8888888888' -Title 'Staff Super Hero' -Department 'Batman Cloud Services' -Enabled $True -StreetAddress 'Gotham Street' -City 'Gotham' -State 'CA' -Country 'USA' -Path 'CN=Users,OU=Operations,DC=darknight,DC=com' -employeeNumber '1234567' -ChangePasswordAtLogon $True
© www.soinside.com 2019 - 2024. All rights reserved.