SynopsisConfigures the Windows Update Agent settings on a local or remote computer.
- Set-WindowsUpdateAgent [-UpdateMethod] [-DetectionFrequency] [-InstallDay] [-InstallHour] [-WSUSServer] [-RescheduledUpdateDelay] [-DisabledRescheduleUpdates] [-DisableWSUS] [-IncludeRecommendedUpdates] [-ExcludeRecommendedUpdates] [-AllowNonAdminInstallations] [-DisallowNonAdminInstallations] [-ComputerName] [-Credential]
- Set-WindowsUpdateAgent [-ResetToDefaults] [-ComputerName] [-Credential]
DescriptionThe Set-WindowsUpdateAgent cmdlet is used to configure the settings associated with Windows Update and the Windows Update Agent, such as install time, polling frequency, recommended update settings and WSUS configuration, on the local or a remote computer.
- UpdateMethod Configure the way in which the Windows Update Agent will handle update checking and installation. Valid update methods are "DownloadAndInstall" (download and install updates automatically), "DownloadOnly" (download updates but allow the user to choose whether to install them), "CheckOnly" (check for updates but allow the user to choose whether to download and install them), "DisableUpdates" (never check for updates).
- DetectionFrequency Configure the Windows Update Agent to check for new updates at this interval. Intervals are measured in hours and valid intervals are 1 - 22.
- InstallDay Configure the Windows Update Agent to install updates on this day. Valid days are EveryDay (or All), Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
- InstallHour Configure the Windows Update Agent to install updates at this hour. Valid hours are 0 - 23.
- WSUSServer Configure the Windows Update Agent to use the WSUS server at this address. The WSUS server address should start http:// or https://.
- RescheduledUpdateDelay Configure the Windows Update Agent to wait this number of minutes after a system restart to begin installation of missed scheduled updates. Valid update delays are 1 - 60.
- DisableRescheduleUpdates Configure the Windows Update Agent not to reschedule missed updates and instead perform the installation at the next scheduled installation time.
- DisableWSUS Configure the Windows Update Agent not to use WSUS and default back to Microsoft's update servers.
- IncludeRecommendedUpdates Configure the Windows Update Agent to install recommended updates as well as important updates.
- ExcludeRecommendedUpdates Configure the Windows Update Agent to install important updates only.
- AllowNonAdminInstallations Allow non-administrators to install Windows Updates.
- DisallowNonAdminInstallations Only allow administrators to install Windows Updates.
- ResetToDefaults Clear Windows Update settings set by this cmdlet or group policy.
- 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.
InputsSet-WindowsUpdateAgent accepts the output of Get-WindowsUpdateAgent as an input object. The UpdateMethod, DetectionFrequency, InstallDay, InstallHour, WSUSServer and ComputerName parameters each accept pipeline input by property name.
OutputsSet-WindowsUpdateAgent makes changes directly to the Windows registry and does not output any Powershell objects.
NotesThe Set-WindowsUpdateAgent cmdlet requires that the RPC service is started on the computer it is trying to access and that DNS services are available to resolve target host names.
Example 1This command will set the Windows Update Agent on the local computer to automatically download and install Windows Updates. Windows will check for updates every 18 hours and updates will be installed each Sunday night at 3am:
Set-WindowsUpdateAgent -UpdateMethod Install -DetectionFrequency 18 -InstallDay Sunday -InstallHour 3
Example 2This command will set the Windows Update Agent on remote computer PC01 to automatically attempt to install missed updates 15 minutes after coming online following a missed schedules install:
Set-WindowsUpdateAgent -RescheduleUpdateDelay 15 -Computer PC01
Example 3This command will set the Windows Update Agent on the local computer not to reschedule updates and to wait for the next scheduled install time to retry installing pending updates:
Example 4This command will reset the Windows Update Agent on the local computer to the original Windows settings, removing the effects of group policy or this cmdlet. However, if a group policy object is still applied to the computer the settings will be recreated at the next scheduled policy update. Group policy settings will always take precedence over local Windows settings and settings made by this cmdlet:
Example 5Set-WindowsUpdateAgent can be used in conjunction with the Get-WindowsUpdateAgent cmdlet. In this example the Windows Update Agent settings on computer PC01 are retrieved and then replicated on PC02:
Get-WindowsUpdateAgent -Computer PC01 | Set-WindowsUpdateAgent -Computer PC02