Site icon WinCert

Run a scheduled task via command line

<p><a href&equals;"http&colon;&sol;&sol;wincert&period;net&sol;wp-content&sol;uploads&sol;2015&sol;01&sol;windows-server&period;jpg"><img class&equals;"alignnone size-full wp-image-550" src&equals;"http&colon;&sol;&sol;wincert&period;net&sol;wp-content&sol;uploads&sol;2015&sol;01&sol;windows-server&period;jpg" alt&equals;"Windows Server" width&equals;"720" height&equals;"340" &sol;><&sol;a><br &sol;>&NewLine;After I had permission issues with running a simple batch job on the server even with local administrator permissions and UAC turned off&comma; I had to find another way for running a batch job remotely&period;<&sol;p>&NewLine;<p>The solution was to use Scheduled Tasks&comma; since it has the option to run the task under highest privileges&period;<&sol;p>&NewLine;<p>Since this is a backup job&comma; we need to run a scheduled task remotely by running a scheduled task from the batch file&comma; because of the permission issues&period; sounds confusing&comma; right&quest;<&excl;--more--><&sol;p>&NewLine;<p>To be able to run the scheduled task from a &period;bat file we will use &&num;8216&semi;<strong>schtasks<&sol;strong>&&num;8216&semi; command&comma; in this case on Windows Server 2008 R2 machine&period;<&sol;p>&NewLine;<p>If our scheduled task job name is <strong>BackupTask<&sol;strong> and machine name is <strong>SPAN<&sol;strong> here&&num;8217&semi;s how the command should look&colon;<&sol;p>&NewLine;<p><strong>schtasks &sol;run &sol;s &bsol;&bsol;ServerName &sol;TN &&num;8220&semi;TaskName&&num;8221&semi;<&sol;strong><&sol;p>&NewLine;<p>or in our case<&sol;p>&NewLine;<p><strong>schtasks &sol;run &sol;s &bsol;&bsol;Span &sol;TN Backuptask<&sol;strong><&sol;p>&NewLine;

Exit mobile version