set password in join domain script This topic contains 4 replies, has 2 voices, and was last updated by Mark Prior 10 months ago. Author Posts June 29, 2016 at 10:58 am #45239 Jeremy SmitParticipant I whant to create a script to when it runs it joins domain automaticaly. when i do the following $Admin = get-credential domain\user, it popsup with a screen to fill in the password. is it possible to make the script so that if i run it joins domain auto? Script so far below $Admin = get-credential domain\admin [password?] Add-Computer -DomainName domainname.local -Credential $admin -restart June 29, 2016 at 11:12 am #45241 Mark PriorParticipant not tested as i dont have my laptop but this should work / at least hold the credentials $Username = "Domain\Username" $Password = ConvertTo-SecureString "Password" -AsPlainText -Force $Admin = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password Add-Computer -DomainName domainname.local -Credential $admin -restart June 29, 2016 at 11:17 am #45251 Jeremy SmitParticipant Seems Legit, i'm gonna test this and will reply back if it worked. Thank you so far Mark. Kind regards, Jeremy June 30, 2016 at 5:41 am #45314 Jeremy SmitParticipant @ Mark Prior. Is it possible to build in the script that powershell will be elevated to administrator? June 30, 2016 at 9:01 am #45327 Mark PriorParticipant quite a few options discussed here that should help http://stackoverflow.com/questions/7690994/powershell-running-a-command-as-administrator cheers Author Posts You must be logged in to reply to this topic.