Automate changing password for scheduled tasks on multiple servers

M

Marc

Hi,

I have several hundred servers in the same domain. Each server has the same
scheduled task. I need to change the service acct. password on each server.

After doing some searching and even talking to MS, I haven't found what I'm
looking for. Plus, I suck at scripting.

So..I'm going to use schtasks to write a batch file. However, schtasks only
shows how to do one server at a time. My thought is to write a call in the
script to point to a .txt file which has a list of all the servers I want to
change.

Can someone point me to an example of a script like this or offer up any
suggestions or samples.

I know this issue comes up a lot, yet there doesn't really seem to be
anything concrete. Thanks.
 
P

Pegasus \(MVP\)

Marc said:
Hi,

I have several hundred servers in the same domain. Each server has the same
scheduled task. I need to change the service acct. password on each server.

After doing some searching and even talking to MS, I haven't found what I'm
looking for. Plus, I suck at scripting.

So..I'm going to use schtasks to write a batch file. However, schtasks only
shows how to do one server at a time. My thought is to write a call in the
script to point to a .txt file which has a list of all the servers I want to
change.

Can someone point me to an example of a script like this or offer up any
suggestions or samples.

I know this issue comes up a lot, yet there doesn't really seem to be
anything concrete. Thanks.

This shouldn't be too hard:
1. Create a one-line batch file containing the appropriate schtask.exe
command. Let's name it xxx.bat.
2. Test it on one or two servers.
3. Place that batch file into a central location that is accessible to
all servers.
4. Create a batch file on your own PC that looks like so:

@echo off
for /F %%a in (c:\Servers.txt) do (
echo Processing server %%a
ping %%a | find /i "bytes=" > nul
if %ErrorLevel% == 0 (
echo %date% %time:~0,5% %%a >> c:\Done.txt
psexec \\%%a \\SomeServer\SomeShare\xxx.bat
) else (
echo %%a >> c:\Missed.txt
)
)

After running this batch file, c:\Done.txt will contain a list
of the servers you were able to reach whereas c:\Missed.txt
will contain a list of those that were unreachable.

A general thought: If you look after several hundred servers
then you could save yourself enormous amounts of time by
using scripting techniques and using tools such as psexec.exe
(which is available from www.sysinternals.com).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top