10

Quick Tip - Get All SMA Runbook Schedules That Will Run Between Now And Then

 3 years ago
source link: https://thomasrayner.ca/quick-tip-get-all-sma-runbook-schedules-that-will-run-between-now-and-then/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Quick Tip - Get All SMA Runbook Schedules That Will Run Between Now And Then

I wanted to do some maintenance on my SMA runbook servers but couldn’t remember which jobs were going to run in the next 12 hours (if any). Luckily there’s a quick way of getting that information! This work assumes that you have the SMA tools installed and that you ran the below command or have it as part of your profile.

import-module Microsoft.SystemCenter.ServiceManagementAutomation

Behold!

get-smaschedule -WebServiceEndpoint "https://your-server" | ? { $_.NextRun -gt (get-date).date -and $_.NextRun -lt (get-date).addhours(12)}

This isn’t a very crazy command. “your-server” is the server where you have the SMA management items installed, not an individual runbook server.

You’re getting all the SMA schedules from your SMA instance and filtering for items whose next run is after “now” and before “now plus 12 hours”. You can change the get-date related items easily to suit your needs. For instance, what ran last night? What will run tomorrow? What ran on October 31?

Written on December 17, 2014

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK