Share via


New-ADComputer : A required attribute is missing - Issue using "-path"

Question

Friday, August 14, 2015 6:38 PM

I am trying to make a simple script to create a new computer object in AD.  I took out all variables and put the real data in and i get an error.  Below is the line of code I am trying to run.  Under that is the error.  Can somebody help me out?

CODE:

 New-ADComputer -Name XXXXXXXX -Description test -Path "OU=Laptop,OU=Computers,OU=SID,OU=US,OU=NA,OU=XXXXX,DC=XXX,DC=ad,DC=XXXXXX,DC=com" -SAMAccountName XXXXXXXX

ERROR:

New-ADComputer : A required attribute is missing
At line:1 char:1

  • New-ADComputer -Name XXXXXXXX -Description test -Path
    "OU=Laptop,OU=Computers,OU ...
    + CategoryInfo          : NotSpecified: (CN=XXXXXXXX,OU=...,DC=XXXX,DC=com  
   :String) \[New-ADComputer\], ADException  
    + FullyQualifiedErrorId : A required attribute is missing,Microsoft.Active  
   Directory.Management.Commands.NewADComputer

  

#### All replies (10)

<sub>Monday, August 17, 2015 5:09 PM ✅Answered | **1 vote**</sub>

This is all you need to do:

``` prettyprint
New-ADComputer -Name L4NGH5R1 -Description test -Path 'OU=Laptop,OU=Computers,OU=SID,OU=US,OU=NA,OU=ACCO Global,DC=abd,DC=ad,DC=acco,DC=com' -SAMAccountName 'L4NGH5R1$'
```

if you continue to get the same error then you need to contact support professionals to fix your network.  It is NOT a scripting issue.

\\(ツ)\_/

------------------------------------------------------------------------

<sub>Friday, August 14, 2015 7:00 PM</sub>

I suggest that you have an illegal character in one of your XXXX out names.

\\(ツ)\_/

------------------------------------------------------------------------

<sub>Monday, August 17, 2015 2:01 PM</sub>

New-ADComputer -Name L4NGH5R1 -Description test -Path "OU=Laptop,OU=Computers,OU=SID,OU=US,OU=NA,OU=XXXX Global,DC=abd,DC=ad,DC=XXXX,DC=com" -SAMAccountName L4NGH5R1$

that's the code I just rand and it still failed.

------------------------------------------------------------------------

<sub>Monday, August 17, 2015 2:08 PM</sub>

Your path is still likely bad. We can't tell though, since you keep editing it.

Copy it directly from ADUC instead of typing it and see if that helps you.

[![](https://onedrive.live.com/download?cid=A416FE96970C0EA0&resid=A416FE96970C0EA0%21155&authkey=AFbDChf1iUFuko0)](https://archive.org/details/GratefulDead)

------------------------------------------------------------------------

<sub>Monday, August 17, 2015 2:13 PM</sub>

Are you running this on your DC? If not, have you got RSAT installed on your computer? Try specifying the -server switch to see if its an LDAP connection/permission issue.

------------------------------------------------------------------------

<sub>Monday, August 17, 2015 2:35 PM</sub>

I copied it directly from Object DN in the Object Tab in AD

------------------------------------------------------------------------

<sub>Monday, August 17, 2015 2:39 PM</sub>

New-ADComputer -Server "abd.ad.acco.com" -Name "L4NGH5R1" -Description "test" -Path "OU=Laptop,OU=Computers,OU=SID,OU=US,OU=NA,OU=ACCO Global,DC=abd,DC=ad,DC=acco,DC=com" -SAMAccountName "L4NGH5R1$"

there's the exact command.  It still failed with quotes and I have RSAT enabled.

------------------------------------------------------------------------

<sub>Monday, August 17, 2015 4:46 PM</sub>

It is not necessary to elevate to use AD commands.  It is required that you have admin status to alter AD.

The error show that there is likely a network issue.

"A required attribute is missing,Microsoft.Active  
   Directory.Management.Commands.NewADComputeR"

\\(ツ)\_/

------------------------------------------------------------------------

<sub>Monday, August 17, 2015 4:54 PM</sub>

I am running as administrator.  Get-ADComputer works fine.  

------------------------------------------------------------------------

<sub>Monday, August 17, 2015 5:12 PM</sub>

Excellent.  Thank you for the confirmation.