New-LXCAScheduleObj
This cmdlet creates a local schedule object that can be used with certain cmdlets to create a scheduled job on Lenovo XClarity Administrator.
Note
You cannot pipe objects to this cmdlet.
Syntax
New-LXCAScheduleObj [-Connection LXCAConnection]
-ScheduleName String]
-OccurrenceDate DateTime
[CommonParameter
New-LXCAScheduleObj [-Connection LXCAConnection]
-ScheduleName String]
-Rule ScheduleRule
[CommonParameter
Parameters
- -Connection LXCAConnection
- Specifies the connection to the Lenovo XClarity Administrator server. If no connection is specified, the result from the last Connect-LXCA cmdlet is used.
- -ScheduleName String
- Specifies schedule name.
- -OccurrenceDate DateTime
- Specifies the date and time when task is to run.
- -Rule ScheduleRule
- Specifies the rule for recurring schedule.
- CommonParameters
- This cmdlet supports the following common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer, -PipelineVariable, -OutVariable. For detailed information about each common parameter, see the Microsoft PowerShell Common Parameters webpage.
Results
- Lenovo.SysMgmt.LXCA.Integration.Data.ScheduleObject
This cmdlet returns a ScheduleObject that can be used with certain cmdlets to create a scheduled job on XClarity Administrator.
Examples
The following example creates a schedule to update the management server on specific date and time.
$cred = Get-Credential
Connect-LXCA -Host 192.0.2.0 -Port 443 -Credential $cred
$scheduleName = "Update-Package-Install"
$schedule = New-LXCAScheduleObj -ScheduleName $scheduleName `
-OccurrenceDate '2022-2-22 02:00:00'
# Use the Schedule object in the Install-LXCAUpdateManagementServer cmdlet.
$fixId = lnvgy_utl_lxca-core_2.4.0-2019xxxx_anyos_noarch
Install-LXCAUpdateManagementServer -FixId $fixId -Schedule $schedule
Disconnect-LXCA
The following example creates a schedule to update the management server tomorrow, using the Get-Date cmdlet.
$cred = Get-Credential
Connect-LXCA -Host 192.0.2.0 -Port 443 -Credential $cred
$scheduleName = "Update-Package-Install"
$schedule = New-LXCAScheduleObj -ScheduleName $name -OccurrenceDate (Get-Date).AddDays(1)
# Use the Schedule object in the Install-LXCAUpdateManagementServer cmdlet.
$fixId = lnvgy_utl_lxca-core_2.4.0-2019xxxx_anyos_noarch
Install-LXCAUpdateManagementServer -FixId $fixId -Schedule $schedule
Disconnect-LXCA
The following example creates a recurring schedule to restart a specific device on the third Wednesday of the month over a 2-year period, starting February 22, 2022.
$cred = Get-Credential
Connect-LXCA -Host 192.0.2.0 -Port 443 -Credential $cred
# Create a rule for the schedule.
$monthlyRule = New-LXCAScheduleRule -DayOfTheWeek Wednesday `
-WeekOfTheMonth ThirdWeek `
-RecurEvery 3 `
-StartTimeStamp "2022-2-22 02:00:00" `
-EndDate "2024-2-22"
$scheduleName = "server-restart"
$reccuringSchedule = New-LXCAScheduleObj -ScheduleName $scheduleName -Rule $monthlyRule
# Use the Schedule object in Invoke-LXCASystemAction cmdlet to restart the server.
Invoke-LXCASystemAction -DeviceUuid AAAAAAAAAAAA `
-ServerAction ShutdownOSandRestart `
-Schedule $reccuringSchedule `
-Force
Disconnect-LXCA
Give documentation feedback