Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
I will ask on SO, too. You never know.… – 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
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.

share|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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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