This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Set-MaintenanceSchedule

Synopsis

Sets the automatic maintenance schedule of a local or remote computer running Windows 8 or higher.

Syntax

  • Set-MaintenanceSchedule [-StartTime] [-RandomDelay] [-Wake] [-NoWake] [-Reset] [-ComputerName] [-Credential]

Description

The Set-MaintenanceSchedule cmdlet is used to configure the automatic maintenance configuration of local or remote computers running Windows 8 or higher. This cmdlet replaces the scheduling features of the Set-WindowsUpdateAgent cmdlet for computers running Windows 8.

Parameters

  • StartTime The time at which to start daily maintenance tasks.
  • RandomDelay A random offset to the daily maintenance start time. This is typically used when configuring virtual machines and you do not want maintenance to occur simultaneously on all of them.
  • Wake Allow scheduled maintenance to wake the computer at the maintenance start time.
  • NoWake Disallow scheduled maintenance from waking the computer at the maintenance start time.
  • Reset Revert changes made by this cmdlet and group policy, returning the computer to its local default maintenance configuration.
  • ComputerName The computer against which to run the cmdlet. By default this parameter will be populated with the name of the local computer.
  • Credential The credentials under which to run the cmdlet. By default this cmdlet will run as the current user. Using this parameter and the Get-PSCredential cmdlet you can specify an alternate set of credentials under which to execute this command.

Inputs

Set-MaintenanceSchedule accepts the output of Get-MaintenanceSchedule as an input object for the StartTime, RandomDelay and ComputerName parameters

Outputs

Set-MaintenanceSchedule does not return any PowerShell objects.

Notes

There are no notes associated with this cmdlet.

Example 1

This command will configure automatic maintenance on the local computer to start at 3am, wake the computer if necessary and add a random delay of 40 minutes:

C:\PS>Set-MaintenanceSchedule -StartTime 03:00 -Wake -RandomDelay 40

Example 2

This command will set automatic maintenance to start at 4am on the remote computers PC01 and PC02:

C:\PS>Set-MaintenanceSchedule -StartTime 04:00 -ComputerName PC01, PC02

Example 3

This command will copy the start time and random delay settings from PC01 and set them on PC02:

C:\PS>Set-MaintenanceSchedule -ComputerName PC01 | Set-MaintenanceSchedule -ComputerName PC02