Thomas' Tech Talk

Just Can't Get Enough Of IT

Start Scheduled Tasks Remotely

Filed under: Exchange Server,PowerShell — Thomas Stensitzki at 4:00 pm on Saturday, July 18, 2020  Tagged

When you maintain a number of servers which require to trigger the same scheduled task manually, you can simply the process by triggering the scheduled task remotely.

In this example, I assume that the script is being executed on a dedicated management server (aka job server) within an Exchange Server 2013 environment. The scheduled task must exist on all servers having the same name.

Create a simple PowerShell script at a file location of your choice (i.e. D:\Scripts\Start-RemoteScheduledTasks.ps1)

$cimSession = New-CimSession -ComputerName SERVER1,SERVER2,SERVER3,SERVER4

Start-ScheduledTask TASKNAME -CimSession $cimSession

Remove-CimSession $cimSession

Now create a new shortcut on your server desktop with the following configuration:

Target: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command “& D:\Scripts\Start-RemoteScheduledTasks.ps1” 

If required, select “Run as Adminstrator” in the Shortcut -> Advanced settings.

Enjoy!

 


This post was previously published on my legacy SF-Tools blog.
Original publishing date: 2015-02-26



No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>