LPetersson
MIS
I'm having to change the account used by some services spread over a vast
number of servers and naturally I don't want to do this manually.
Unfortunately the organisation I work for is overly secure, so the password
for the accounts to be used are not known by any one person.
Instead each password is broken down into two halves and two different
people would have each half.
The commands I think I will need to use are essentially:
Set service_name=
FOR /f "tokens=1" %%servername IN (c:\SvcActPwd\server.txt)
SET server=%servername
psexec \\%server% sc config %Service_Name% obj= [DOM\User] password=%password%
A couple of points:
1) The text file specified will have a number of server names in it.
2) The service_name will be set to the actual service name by the person
running the script.
3) Psexec is a utility which allows you to easily execute commands on a
remote system.
4) I need to input the password securely i.e. the two people typing the
password in can't see the other half, so a prompt with either stars (*) or
blanks is needed.
I haven't been able to find a way to input that as the script runs, but I
might just not now what I'm really looking for.
Alternately I could have two files each with one half of the password and
input them.
I guess I'd have to do this:
FOR /f "tokens=1" %%password1 IN (c:\SvcActPwd\pass1.txt)
FOR /f "tokens=1" %%password2 IN (c:\SvcActPwd\pass2.txt)
Set pass1=%password1
Set pass2=%password2
psexec \\%server% sc config %Service_Name% obj= [DOM\User]
password=%pass1%%pass2%
Does this look right?
I'm fairly new to this type of advanced cmd scripting as I have mostly done
simple(ish) batch files before.
Many thanks for any help/comments...
Cheerio,
Lars Petersson
number of servers and naturally I don't want to do this manually.
Unfortunately the organisation I work for is overly secure, so the password
for the accounts to be used are not known by any one person.
Instead each password is broken down into two halves and two different
people would have each half.
The commands I think I will need to use are essentially:
Set service_name=
FOR /f "tokens=1" %%servername IN (c:\SvcActPwd\server.txt)
SET server=%servername
psexec \\%server% sc config %Service_Name% obj= [DOM\User] password=%password%
A couple of points:
1) The text file specified will have a number of server names in it.
2) The service_name will be set to the actual service name by the person
running the script.
3) Psexec is a utility which allows you to easily execute commands on a
remote system.
4) I need to input the password securely i.e. the two people typing the
password in can't see the other half, so a prompt with either stars (*) or
blanks is needed.
I haven't been able to find a way to input that as the script runs, but I
might just not now what I'm really looking for.
Alternately I could have two files each with one half of the password and
input them.
I guess I'd have to do this:
FOR /f "tokens=1" %%password1 IN (c:\SvcActPwd\pass1.txt)
FOR /f "tokens=1" %%password2 IN (c:\SvcActPwd\pass2.txt)
Set pass1=%password1
Set pass2=%password2
psexec \\%server% sc config %Service_Name% obj= [DOM\User]
password=%pass1%%pass2%
Does this look right?
I'm fairly new to this type of advanced cmd scripting as I have mostly done
simple(ish) batch files before.
Many thanks for any help/comments...
Cheerio,
Lars Petersson