wajhiuddin
asked on
how to add windows 7 computer to domain using comand line (Powershell)
I am trying windows 7 workstation to join a domain using command line
I am using command "powershell Add-computer -domainname abcd.xyz.com -cred xyz\user -password " but I am getting a prompt to enter a password I need to run this remotely and need to find a way so I can add a password in to this command,
I am using command "powershell Add-computer -domainname abcd.xyz.com -cred xyz\user -password " but I am getting a prompt to enter a password I need to run this remotely and need to find a way so I can add a password in to this command,
Are you wanting to do this when the PC is imaged or for an existing pc not on the domain?
ASKER
I had this link already which i found by goolge but it'a lenghty process for me and I got lost by followilng it
ASKER
existing pc not on domain
Did you also read the linked article on how to store the password? The technet post is a bit of a sidetrack and ends up using good 'ol netdom.
This site has the scripts to store your password and how to recall it when you run your powershell commands.
http://bsonposh.com/archives/338
which also lead me to http://www.leeholmes.com/blog/ImportingAndExportingCredentialsInPowerShell.aspx
You can use his script to create a file that will store the password that you want to use with your powershell command. Then your powershell command can recall the password from that file.
In his example, you have to login to the computer as the user who will run the script, then run the script to store the password. Only the user who created the test file can read the password. So, he also shows how to store the password as plain text if you're trying to read the password across the network. It's further down in the comments in the bsonposh.com post.
This site has the scripts to store your password and how to recall it when you run your powershell commands.
http://bsonposh.com/archives/338
which also lead me to http://www.leeholmes.com/blog/ImportingAndExportingCredentialsInPowerShell.aspx
You can use his script to create a file that will store the password that you want to use with your powershell command. Then your powershell command can recall the password from that file.
In his example, you have to login to the computer as the user who will run the script, then run the script to store the password. Only the user who created the test file can read the password. So, he also shows how to store the password as plain text if you're trying to read the password across the network. It's further down in the comments in the bsonposh.com post.
ASKER
I am sorry I really don't know any thing about VB scripting I tried first scritp and its giving my this error
Sorry about the late response I was out of the office for the weekend,
Thanks
Wajhi
Cred.bmp
ASKER
here is the first script
CRED.VBS
CRED.VBS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry still working on it
ASKER
this works well thanks
This describes the same situation that you're in, but they used a different method than powershell ultimately. Although the MS rep did say that you could encrypt the password into a file and read the password from that file using a script. Either way, I hope you find it useful.
cheers