New-AzAutomationSchedule
Creates an Automation schedule.
Syntax
ByDaily (Default)
New-AzAutomationSchedule
[-Name] <String>
[-StartTime] <DateTimeOffset>
[-ResourceGroupName] <String>
[-AutomationAccountName] <String>
-DayInterval <Byte>
[-Description <String>]
[-ExpiryTime <DateTimeOffset>]
[-TimeZone <String>]
[-ForUpdateConfiguration]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByWeekly
New-AzAutomationSchedule
[-Name] <String>
[-StartTime] <DateTimeOffset>
[-ResourceGroupName] <String>
[-AutomationAccountName] <String>
-WeekInterval <Byte>
[-Description <String>]
[-DaysOfWeek <DayOfWeek[]>]
[-ExpiryTime <DateTimeOffset>]
[-TimeZone <String>]
[-ForUpdateConfiguration]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByMonthlyDaysOfMonth
New-AzAutomationSchedule
[-Name] <String>
[-StartTime] <DateTimeOffset>
[-ResourceGroupName] <String>
[-AutomationAccountName] <String>
-MonthInterval <Byte>
[-Description <String>]
[-DaysOfMonth <DaysOfMonth[]>]
[-ExpiryTime <DateTimeOffset>]
[-TimeZone <String>]
[-ForUpdateConfiguration]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByMonthlyDayOfWeek
New-AzAutomationSchedule
[-Name] <String>
[-StartTime] <DateTimeOffset>
[-ResourceGroupName] <String>
[-AutomationAccountName] <String>
-MonthInterval <Byte>
[-Description <String>]
[-DayOfWeek <DayOfWeek>]
[-DayOfWeekOccurrence <DayOfWeekOccurrence>]
[-ExpiryTime <DateTimeOffset>]
[-TimeZone <String>]
[-ForUpdateConfiguration]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByOneTime
New-AzAutomationSchedule
[-Name] <String>
[-StartTime] <DateTimeOffset>
[-ResourceGroupName] <String>
[-AutomationAccountName] <String>
[-Description <String>]
[-OneTime]
[-TimeZone <String>]
[-ForUpdateConfiguration]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByHourly
New-AzAutomationSchedule
[-Name] <String>
[-StartTime] <DateTimeOffset>
[-ResourceGroupName] <String>
[-AutomationAccountName] <String>
-HourInterval <Byte>
[-Description <String>]
[-ExpiryTime <DateTimeOffset>]
[-TimeZone <String>]
[-ForUpdateConfiguration]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The New-AzAutomationSchedule cmdlet creates a schedule in Azure Automation.
Examples
Example 1: Create a one-time schedule in local time
$TimeZone = ([System.TimeZoneInfo]::Local).Id
New-AzAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule01" -StartTime "23:00" -OneTime -ResourceGroupName "ResourceGroup01" -TimeZone $TimeZone
The first command gets the time zone ID from the system and stores it in the $TimeZone variable.
The second command creates a schedule that runs one time on the current date at 11:00 PM in the specified time zone.
Example 2: Create a one-time schedule in another time zone
$TimeZone = "Europe/Paris"
New-AzAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule01" -StartTime "23:00Z" -OneTime -ResourceGroupName "ResourceGroup01" -TimeZone $TimeZone
The first command initializes a $TimeZone variable with value Europe/Paris
The second command creates a schedule that runs one time on the current date at 23:00 UTC in the specified time zone.
Note: Schedule StartTime is calculated by adding the TimeZone Offset to provided StartTime
Example 3: Create a recurring schedule
$StartTime = Get-Date "13:00:00"
$EndTime = $StartTime.AddYears(1)
New-AzAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule02" -StartTime $StartTime -ExpiryTime $EndTime -DayInterval 1 -ResourceGroupName "ResourceGroup01"
The first command creates a date object by using the Get-Date cmdlet, and then stores the object in the $StartDate variable.
Specify a time that is at least five minutes in the future.
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.
The final command creates a daily schedule named Schedule02 to begin at the time stored in $StartDate and expire at the time stored in $EndDate.
Example 4: Create a weekly recurring schedule
$StartTime = (Get-Date "13:00:00").AddDays(1)
[System.DayOfWeek[]]$WeekDays = @([System.DayOfWeek]::Monday..[System.DayOfWeek]::Friday)
New-AzAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule03" -StartTime $StartTime -WeekInterval 1 -DaysOfWeek $WeekDays -ResourceGroupName "ResourceGroup01"
The first command creates a date object by using the Get-Date cmdlet, and then stores the object in the $StartDate variable.
The second command creates an array of week days that contains Monday, Tuesday, Wednesday, Thursday and Friday.
The final command creates a daily schedule named Schedule03 that will run Monday to Friday each week at 13:00. The schedule will never expire.
Parameters
-AutomationAccountName
Specifies the name of an Automation account for which this cmdlet creates a schedule.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-DayInterval
Specifies an interval, in days, for the schedule.
If you do not specify this parameter, and you do not specify the OneTime parameter, the default value is one (1).
Parameter properties
Type: Byte
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByDaily
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DayOfWeek
Specifies a list of days of the week for the weekly schedule.
Parameter properties
Type: Nullable<T> [ DayOfWeek ]
Default value: None
Accepted values: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
Supports wildcards: False
DontShow: False
Parameter sets
ByMonthlyDayOfWeek
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DayOfWeekOccurrence
Specifies the occurrence of the week within the month that the schedule runs.
psdx_paramvalues
1
2
3
4
-1
First
Second
Third
Fourth
LastDay
Parameter properties
Type: DayOfWeekOccurrence
Default value: None
Accepted values: First, Second, Third, Fourth, Last
Supports wildcards: False
DontShow: False
Parameter sets
ByMonthlyDayOfWeek
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DaysOfMonth
Specifies a list of days of the month for the monthly schedule.
Parameter properties
Type: DaysOfMonth [ ]
Default value: None
Accepted values: One, Two, Three, Four, Five, Six, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth, Thirteenth, Fourteenth, Fifteenth, Sixteenth, Seventeenth, Eighteenth, Nineteenth, Twentieth, TwentyFirst, TwentySecond, TwentyThird, TwentyFourth, TwentyFifth, TwentySixth, TwentySeventh, TwentyEighth, TwentyNinth, Thirtieth, ThirtyFirst, LastDay
Supports wildcards: False
DontShow: False
Parameter sets
ByMonthlyDaysOfMonth
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DaysOfWeek
Specifies a list of days of the week for the weekly schedule.
Parameter properties
Type: DayOfWeek [ ]
Default value: None
Accepted values: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
Supports wildcards: False
DontShow: False
Parameter sets
ByWeekly
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Description
Specifies a description for the schedule.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ExpiryTime
Specifies the expiry time of a schedule as a DateTimeOffset object.
You can specify a string that can be converted to a valid DateTimeOffset .
Parameter properties
Type: DateTimeOffset
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByDaily
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ByWeekly
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ByMonthlyDaysOfMonth
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ByMonthlyDayOfWeek
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ByHourly
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ForUpdateConfiguration
Indicates that this schedule object will be used for scheduling a software update configuration
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-HourInterval
Specifies an interval, in hours, for the schedule.
Parameter properties
Type: Byte
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByHourly
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-MonthInterval
Specifies an interval, in Months, for the schedule.
Parameter properties
Type: Byte
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByMonthlyDaysOfMonth
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ByMonthlyDayOfWeek
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Name
Specifies a name for the schedule.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-OneTime
Specifies that the cmdlet creates a one-time schedule.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByOneTime
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
Specifies the name of a resource group for which this cmdlet creates a schedule.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-StartTime
Specifies the start time of a schedule as a DateTimeOffset object.
You can specify a string that can be converted to a valid DateTimeOffset .
If the TimeZone is provided, StartTime is calculated by adding the Offset of Input TimeZone .
Parameter properties
Type: DateTimeOffset
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 3
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-TimeZone
Specifies the time zone for the schedule.
This string can be the IANA ID or the Windows Time Zone ID.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-WeekInterval
Specifies an interval, in weeks, for the schedule.
Parameter properties
Type: Byte
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByWeekly
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs