none
New-ADOrganizationalUnit in powershell when deploy active directory get TerminatingError RRS feed

  • Question

  • Hello!

    I try create Active Directory in cloud.

    Code

        Write-Host "DomainName: $DomainName"
        Write-Host "domainComponent0: $domainComponent0"
        Write-Host "domainComponent1: $domainComponent1"

        New-ADOrganizationalUnit -Name "TestUserAccounts" -Path "DC=$domainComponent0,DC=$domainComponent0"

    Error:

    DomainName: mydomain.local
    domainComponent0: mydomain
    domainComponent1: local

    PS>TerminatingError(New-ADOrganizationalUnit): "The server is unwilling to process the request"
    New-ADOrganizationalUnit : The server is unwilling to process the request
    At line:143 char:5
    +     New-ADOrganizationalUnit -Name "TestUserAccounts" -Path "DC=$doma ...
    +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (OU=TestUserAcco...ain,DC=mydomain:String) [New-ADOrganizationalUnit], 
    ADException
        + FullyQualifiedErrorId : 
    ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.NewADOrganizationalUnit
    New-ADOrganizationalUnit : The server is unwilling to process the request

    But if dont use variable, code will work

        New-ADOrganizationalUnit -Name "TestUserAccounts" -Path "DC=mydomain,DC=local" 

    • Edited by Anton Patsev Tuesday, September 15, 2020 3:13 PM
    Tuesday, September 15, 2020 2:35 PM

All replies

  • at least you have a typo in a path where you use dc=mydomain,dc=mydomain instead of dc=mydomain,dc=local

    The opinion expressed by me is not an official position of Microsoft

    Tuesday, September 15, 2020 2:39 PM
  • Your -Path parameter value is incorrect:

    You said:
        "DC=$domainComponent0,DC=$domainComponent0"

    It should be:
        "DC=$domainComponent0,DC=$domainComponent1"


    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)

    Tuesday, September 15, 2020 2:48 PM