Welcome to Powergui.org - an open source community for Windows Powershell

PowerGUI.org PowerGUI.org and blogs

Forums » Active Directory and PowerShell

Thread: New-QADObject computer created as disabled

This question is not answered.


Permlink Replies: 14 - Pages: 1 - Last Post: Dec 2, 2009 11:53 PM by: Shay Levy
bprentice_437

Posts: 9
Registered: 11/18/09
New-QADObject computer created as disabled
Posted: Nov 18, 2009 9:22 AM
 
  Click to reply to this thread Reply

I'm sure it's been asked before and answered before but my Google-fu seems weak.

When I create a new computer using:

new-qadobject newpc -parentcontainer "ou=blah,cn=domain,cn=com" -type computer

The computer account is created but is disabled. Is there a way of enabling it that I'm just not seeing? When I use AD Users and Computers to create a computer the account is not disabled so why is there a difference?



bprentice_437

Posts: 9
Registered: 11/18/09
Re: New-QADObject computer created as disabled
Posted: Nov 18, 2009 11:09 AM   in response to: bprentice_437
 
  Click to reply to this thread Reply

I've now noticed that even though it appears that the computer object is created when a new machine is brought up and added to the domain with that name a SECOND machine account is created in the default Computers container versus using the computer object I just created.

Am I missing something vital?



Shay Levy


Posts: 1,346
Registered: 1/31/08
Re: New-QADObject computer created as disabled
Posted: Nov 22, 2009 5:31 AM   in response to: bprentice_437
Answered
  Click to reply to this thread Reply

Have you tried the new version (1.3) of AD cmdlets? There's a new cmdlet, New-QADComputer, you can use to create computer objects. I have tried it and the new object is not disabled (I didn't test in previous version).

Shay Levy [MVP]
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar
bprentice_437

Posts: 9
Registered: 11/18/09
Re: New-QADObject computer created as disabled
Posted: Nov 23, 2009 7:55 AM   in response to: bprentice_437
 
  Click to reply to this thread Reply

That did it.

I see that was just released Thursday so I don't feel too bad about having been using 1.22



bprentice_437

Posts: 9
Registered: 11/18/09
Re: New-QADObject computer created as disabled
Posted: Nov 25, 2009 8:29 AM   in response to: bprentice_437
 
  Click to reply to this thread Reply

I take it back - it sort-of worked.

When I create the computer object via new-qadcomputer and then later (1 day to be exact) try to join a machine using that name the new-qadcomputer created account is NOT used and instead another computer account object is created in the default COMPUTERS container versus the one where I created the new-qadcomputer account.



bprentice_437

Posts: 9
Registered: 11/18/09
Re: New-QADObject computer created as disabled
Posted: Nov 25, 2009 8:29 AM   in response to: bprentice_437
 
  Click to reply to this thread Reply

Sorry - not quite fixed....


Shay Levy


Posts: 1,346
Registered: 1/31/08
Re: New-QADObject computer created as disabled
Posted: Nov 25, 2009 10:02 AM   in response to: bprentice_437
 
  Click to reply to this thread Reply

Can you share the command you used to create the computer object?

Shay Levy [MVP]
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar
bprentice_437

Posts: 9
Registered: 11/18/09
Re: New-QADObject computer created as disabled
Posted: Nov 25, 2009 10:12 AM   in response to: Shay Levy
 
  Click to reply to this thread Reply

Sure :

new-qadcomputer -name workstat17 -parentcontainer "ou=xp,dc=domain,dc=com"


Should I have included additional options? I noticed on the object created with the new-qadcomputer cmdlet the pre-windows2000 attribute was set for what appeared to be random characters.
Message was edited by: bprentice_437


Shay Levy


Posts: 1,346
Registered: 1/31/08
Re: New-QADObject computer created as disabled
Posted: Nov 25, 2009 10:26 AM   in response to: bprentice_437
 
  Click to reply to this thread Reply

Right. Try to add samaccountname, IMO that's the problem:

new-qadcomputer -name workstat17 -samaccountname workstat17 -parentcontainer "cn=xp,dc=domain,dc=com"

Message was edited by: Shay Levy

Shay Levy [MVP]
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar
bprentice_437

Posts: 9
Registered: 11/18/09
Re: New-QADObject computer created as disabled
Posted: Nov 30, 2009 7:03 AM   in response to: Shay Levy
 
  Click to reply to this thread Reply

Tried that this morning:

PS > New-QADComputer workstat18 -SamAccountName workstat18 -ParentContainer "ou=xp,dc=domain,dc=com"

<Wait 1 hour or so as image is put on new machine, get out of meeting, reboot machine, go through sysprep mini-setup>


PS > Get-QADCoputer workstat18

Name                        Type               DN
----                                ----                 --
workstat18                 computer    CN=workstat18,CN=Computers,DC=domain,DC=com
workstat18                 computer    CN=workstat18,OU=xp,DC=domain,DC=com



Message was edited by: bprentice_437


Shay Levy


Posts: 1,346
Registered: 1/31/08
Re: New-QADObject computer created as disabled
Posted: Dec 1, 2009 7:02 AM   in response to: bprentice_437
 
  Click to reply to this thread Reply

What do you get for:

Get-QADCoputer workstat18 | select samaccountname



Shay Levy [MVP]
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar
bprentice_437

Posts: 9
Registered: 11/18/09
Re: New-QADObject computer created as disabled
Posted: Dec 1, 2009 7:11 AM   in response to: Shay Levy
 
  Click to reply to this thread Reply

SamAccountName
--------------
workstat18


I just did the same command against another machine that is working fine - notice the result has a $ at the end of the SamAccountName. So should the command actually be:

new-qadcomputer -name <computer> -samaccountname <computer$> -parentcontainer <my target ou here>

?



Shay Levy


Posts: 1,346
Registered: 1/31/08
Re: New-QADObject computer created as disabled
Posted: Dec 1, 2009 7:29 AM   in response to: bprentice_437
 
  Click to reply to this thread Reply

I would try adding the $ sign at the end of the samaccountname, when I create new computer account via ADUC the samaccountname is having the dollar sign. New-QADComputer bug?

Shay Levy [MVP]
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar
bprentice_437

Posts: 9
Registered: 11/18/09
Re: New-QADObject computer created as disabled
Posted: Dec 2, 2009 12:14 PM   in response to: Shay Levy
 
  Click to reply to this thread Reply

Adding the $ to the end of the samaccountname seems to have set things straight.

It does look like a bug - I would have expected the functionality to be automatically name$ unless the samaccountname option was specified. Instead it appears one needs to specify both name and samaccountname (and even then having to put the dollar sign onto the end of the samaccountname)



Shay Levy


Posts: 1,346
Registered: 1/31/08
Re: New-QADObject computer created as disabled
Posted: Dec 2, 2009 11:53 PM   in response to: bprentice_437
 
  Click to reply to this thread Reply

Yes, name and samaccountname are mandatory. I have forwarded this thread to the Quest team.

Shay Levy [MVP]
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar
Legend
MVP: 2501 + pts
Guru: 2001 - 2500 pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums