Schedule planned outages from Windows Powershell / the command line.

Command Spotlight from Windows Powershell / the command line

Basic commands

  • List Spotlight connections
  • Add a planned outage scheduled to occur once only
  • Add a planned outage scheduled to occur every day
  • Add a planned outage scheduled to occur on given days of the week
  • Add a planned outage scheduled to occur on the given day of the given months
  • Get help

Command parameters

Parameter Use
-Address Required
-ReoccurenceType Once, daily, weekly or monthly.
-StartTime Used to add a planned outage scheduled to occur every day, on given days of the week or given days of given months.
-FinishTime Used to add a planned outage scheduled to occur every day, on given days of the week or given days of given months.
-StartDateTime Used to add a planned outage scheduled to occur once only.
-FinishDateTime Used to add a planned outage scheduled to occur once only.
-Description Optional. Use with any Add-Outage command
-DaysOfWeek Used to add a planned outage scheduled to occur on given days of the week.
-Day Used to add a planned outage scheduled to occur on the given day of the given months.
-WhichWeekInMonth Used to add a planned outage scheduled to occur on the given day of the given months.
-MonthInterval Used to add a planned outage scheduled to occur on the given day of the given months.

Basic commands

List Spotlight connections

Get-Connection

Add a planned outage scheduled to occur once only

Add-Outage -Address @{SqlServer="sqlserver1,sqlserver2,sqlserver3"; Windows="windows1,windows2,windows3"} -ReoccurenceType Once -StartDateTime "10/27/2018 10:46" -FinishDateTime "10/27/2018 12:46" -Description OnceOutageDescription -PassThru

Add a planned outage scheduled to occur every day

Add-Outage -Address @{SqlServer="sqlserver1,sqlserver2,sqlserver3"; Windows="windows1,windows2,windows3"} -ReoccurenceType Daily -StartTime "10:46" -FinishTime "12:46" -Description DailyOutageDescription -PassThru

Add a planned outage scheduled to occur on given days of the week

Add-Outage -Address @{Replication="replication1,replication2"; VMware="vmware1,vmware2,vmware2"} -ReoccurenceType Weekly -DaysOfWeek Monday,Tuesday,Friday -StartTime "1:46" -FinishTime "2:46" -Description "WeeklyReplication and VMware" -PassThru

Add a planned outage scheduled to occur on the given day of the given months

Add-Outage -Address @{SqlServer="sqlserver1,sqlserver2,sqlserver3"; Windows="windows1,windows2,windows3"} -ReoccurenceType Monthly -Day 2 -MonthInterval 3 -StartTime "10:46" -FinishTime "12:46" -Description MonthlyFixedOutageDescription -PassThru
Add-Outage -Address @{SqlServer="sqlserver1,sqlserver2,sqlserver3"; Windows="windows1,windows2,windows3"} -ReoccurenceType Monthly  -WhichWeekInMonth "second" -DayOfWeekInMonth "weekday" -MonthInterval 4 -StartTime "10:46" -FinishTime "12:46" -Description MonthlyNonFixedOutageDescription -PassThru

Get help

Get-Help Add-Outage -full

Windows Powershell / Command line parameters

-Address address

List the connections to be added to the planned outage in the form @{SqlServer=”sqlserver1”} where in this example SqlServer is the connection type and sqlserver1 the address of the SQL Server connection.

The connection types are (case insensitive):

  • sqlserver
  • windows
  • hyperv
  • analysisservices
  • availabilitygroup
  • replication
  • sqlazure
  • vmware
  • unix/linux

For multiple connections of the same connection type, separate each address with a comma as in @{SqlServer=”sqlserver1,sqlserver2”}

For multiple connections of different connection types, list connections of each type separately as in @{SqlServer=”sqlserver1,sqlserver2”; Windows=”windows1,windows2”}

The address of the connection can take the same forms as available in the Spotlight Client | Configure Connections | Properties | Details | Address field. For example: the Server Name, Server Instance Name, or IP address.

-ReoccurenceType value

Value Description
Once This planned outage is scheduled to occur once only.
Daily This planned outage is scheduled to occur every day.
Weekly This planned outage is scheduled to occur on the given day(s) of the week.
Monthly This planned outage is scheduled to occur on the given day(s) of the given months.

-StartTime “12:46”

Used to add a planned outage scheduled to occur every day, on given days of the week or given days of given months. Enclose the time in double quotes. The start time of the planned outage is of the form: hh:mm

-FinishTime “13:46”

Used to add a planned outage scheduled to occur every day, on given days of the week or given days of given months. Enclose the time in double quotes. The finish time of the planned outage is of the form: hh:mm

-StartDateTime “11/4/2018 12:46”

Used to add a planned outage scheduled to occur once only.

The start date and time of the planned outage is of the form: “mm/dd/yyyy hh:mm”

Enclose the date and time in double quotes.

The time is as per the time zone of the Spotlight Diagnostic Server.

-FinishDateTime “11/4/2018 13:46”

Used to add a planned outage scheduled to occur once only.

The end date and time of the planned outage of the form: “mm/dd/yyyy hh:mm”

Enclose the date and time in double quotes.

The time is as per the time zone of the Spotlight Diagnostic Server.

-Description “description”

A description for the planned outage as will be displayed on the Planned Outage dialog.

-DaysOfWeek Monday,Tuesday,Friday

Used to add a planned outage scheduled to occur on given days of the week.

Add the days of the week to conduct the planned outage, separated by a comma.

-Day 2

Used to add a planned outage scheduled to occur on the given day of the given months.

In the above example the outage is scheduled to occur on the second day of given months.

To schedule a planned outage for the last day of the month over multiple months select 31 as the day of the month. This will schedule the outage to the last day of the month regardless of whether the month has 31 days. If the selected day of the month is 29, 30 or 31 then for months that have fewer than those number of days the planned outage will be scheduled for the last day of the month.

-WhichWeekInMonth “second” -DayOfWeekInMonth “weekday”

Used to add a planned outage scheduled to occur on the given day of the given months.

In the above example the outage is scheduled to occur in the second week of the month on a weekday.

-MonthInterval 4

Used to add a planned outage scheduled to occur on the given day of the given months.

In the above example the outage is scheduled to occur every 4 months.