Set-SmaSchedule

Creates or modifies a schedule in SMA.

Syntax

Set-SmaSchedule
   -Name <String>
   [-Description <String>]
   -ScheduleType <String>
   -StartTime <DateTime>
   -ExpiryTime <DateTime>
   -WebServiceEndpoint <String>
   [-Port <Int32>]
   [-AuthenticationType <String>]
   [-Credential <PSCredential>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-SmaSchedule cmdlet creates or modifies a schedule in Service Management Automation (SMA). Specify the name and type of the schedule, and the start and end times.

You can modify only the description when you run this cmdlet against an existing schedule. Start time, expiry time, and day interval can only be set when creating a schedule with this cmdlet.

Examples

Example 1: Create a schedule

PS C:\> $StartDate = Get-Date 
PS C:\> $EndDate = Get-Date -Day 12 -Month 6 -Year 2023
PS C:\> Set-SmaSchedule -StartTime $StartDate -ExpiryTime $EndDate -Name "Schedule01" -ScheduleType "DailySchedule" -WebServiceEndpoint "https://contoso.com/app01"

The first command creates a date object by using the Get-Date cmdlet, and then stores the object in the $StartDate variable. This object reflects the current time.

The second command creates a date object by using the Get-Date cmdlet, and then stores the object in the $EndDate variable. The command specifies a future time. For more information, type Get-Help Get-Date.

The last command sets the schedule named Schedule01 to begin at the time stored in $StartDate and end at the time stored in $EndDate

Parameters

-AuthenticationType

Specifies the authentication type. Valid values are:

  • Basic
  • Windows

The default value for this parameter is Windows. If you use Basic authentication, you must provide credentials by using the Credential parameter.

Type:String
Accepted values:Basic, Windows
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Specifies a PSCredential object for the connection to the SMA web service. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Description

Provides a description for the schedule.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ExpiryTime

Specifies when, as a DateTime object, the schedule ends. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.

Type:DateTime
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of a schedule.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Port

Specifies the port number of the SMA web service.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ScheduleType

Specifies the type of schedule. Valid values for this parameter are:

  • OneTimeSchedule
  • DailySchedule
Type:String
Accepted values:OneTimeSchedule, DailySchedule
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-StartTime

Specifies when, as a DateTime object, the schedule starts. To obtain a DateTime object, use the Get-Date cmdlet.

Type:DateTime
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WebServiceEndpoint

Specifies the endpoint, as a URL, of the SMA web service. You must include the protocol, for example, http:// or https://.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False