I have been working with Add-Computer, trying to get a script going to auto-add local computers to a domain. The code is good, but I cannot for the life of me figure out if there is a way to easily have Add-Computer NOT prompt for passwords (as I am doing this through WinRM). Here is some example code:

$dcred = get-credential domain\admin  
add-computer -domainname domain -credential $dcred -oupath "OU=ou,DC=domain,DC=com"

Getting the credential info is working fine, I have the password and everything..., but add-computer still causes a messagebox prompt on the remote computer. Can this be suppressed somehow? Otherwise some Send-Keys implementation will have to be used, maybe...maybe WASP Send-Keys. Any ideas about how to use Add-Computer without being prompted for credentials would be greatly appreciated.

link|improve this question

60% accept rate
I will ask on SO, too. You never know. stackoverflow.com/questions/2045323/… – asteroid Jan 11 '10 at 22:10
This was my error, basically, and this question can be deleted. I was passing in a PSCredential object from a session that didn't get the credentials forwarded to it correctly. This was the issue. Thanks! – asteroid Jan 14 '10 at 18:50
feedback

1 Answer

up vote 1 down vote accepted

If I follow, you're cool if you can do the credentials from the command-line, but don't want a popup?

Check THIS.

link|improve this answer
thanks, I am an idiot. I was passing in a PSCredential object that was essentially blank. Works fine =p – asteroid Jan 14 '10 at 18:49
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.