We have many NT domains and AD in our environment.
I have a list of computers in a text file (c:\Computers.txt (list of computers))
I need to connect to each machine with a specific local account for that machine.
On all these machines, a local account called eg. testusr has been set up, with the same password on all of them eg. password.
What I need to do is:
Change the following key on these computers in the file
Id like to change the value of AutoEndTasks from 0 to 1.
I have tried the following:
1) Created a local account on MY machine (where I wish to execute the script) with the same credentials as those on the target machines
eg. local account username = testusr, password = password
2) Tried to execute a script that connects to each target machine with passthrough authentication, but this fails. The problem is that I get prompted for <target computer name>\local user account.
What I need help with is:
How do I write a script that:
1) Reads a text file of computer names
2) When the script reads each computer name and tries to connect to that machine, it connects as
eg. not as simply testusr (without the computer name>
3) If I log on to my machine as testusr, and then simply try to execute for example the following:
for /f %%a in (C:\Comptuers.txt) do reg add "\\%%a\hku\.default\Control Panel\Desktop" /v AutoEndTasks /d 1 /f
I get prompted for username and password.
If I put in <computername>\testusr, this will work, otherwise passthrough fails.
Ideally, I need to do the following:
a) Have a safety net, that is:
(i) When I try and connect to each machine, it tries alternate credentials in case the first try fails, or for example the account has been locked out, so something like this...
(ii) When trying to connect to each machine, try..
read the computers.txt file to get the computer name ---> then try connecting as <computername>\testusr
If this fails, then try connecting with a domain account (I can use the same credentials here)
If this fails, then log an error in a text file saying cannot connect, then move on to the next computer in the list.
Any help greatly appreciated.