Update pasword on a service account for a scheduled task.

On a remote server, I am trying to change the password of the service account for scheduled task but gives "ERROR: The parameter is incorrect."
On the net saw it is because of the difference in the format created by command line and the scheduled task created by GUI. Not sure how to overcome this problem. I want to do it in powershell.

C:\>schtasks.exe /change /s Server1 /RU Domain\serviceaccount /RP password /TN "\servicename\packagename"
ERROR: The parameter is incorrect.


  • Edited by NewTo-Net 9 hours 48 minutes ago missing info.
March 30th, 2015 5:17pm

if you want to execute a schtasks command from powershell, you will first need to get the command itself working. But that is not a powershell issue.
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2015 5:44pm

That is true. Is there any work around to schtasks command?

$ComputerName="Server1"

$check="Domain\serviceaccount"

$Password="1234passw0rd"

$strcmd = schtasks.exe /change /s "$ComputerName" /RU "$check" /RP "$Password" /TN "`"\$SystemName\$PackageName`""

March 30th, 2015 5:56pm

Yes there is NewTo-Net, but it isn't pretty!

http://windowsitpro.com/scripting/updating-scheduled-tasks-credentials

Good Luck!

Shane

Free Windows Admin Tool Kit Click here and download it now
March 30th, 2015 7:36pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics