Powershell – add-computer cmdlet cached password question

powershell

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.

Best Answer

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

Check THIS.