I had to change the credentials of an existing Scheduled Task on multiple servers. This is how I did it.

  • Populated Servers.txt with the names of servers.
  • Ran the following ‘script’.
$ServerList = get-content Servers.txt
Foreach ($server in $serverlist)
write-host $server -fore green
SCHTASKS /Change /s $Server /RU <UserName> /RP <Password> /TN TaskName
  • To run the Scheduled Task, replace the command with SCHTASKS /run /s $Server /TN TaskName
  • To query the Scheduled Task, use SCHTASKS /query /s $Server

For more SCHTASKS options, see http://ss64.com/nt/schtasks.html

– Thanks, Jinesh.