How to use the command Get-WUSettings (with examples)
- Windows
- December 25, 2023
The Get-WUSettings
command is part of the external PSWindowsUpdate
module and can only be run under PowerShell. It allows you to retrieve the current Windows Update Agent configuration. By using this command, you can obtain valuable information about the Windows Update settings on your system.
Use case 1: Get the current Windows Update Agent configuration
Code:
Get-WUSettings
Motivation:
- You may want to check the current Windows Update Agent configuration to ensure that your system is set up correctly for automatic updates or to troubleshoot any issues related to Windows Update.
Explanation:
- This command retrieves the current Windows Update Agent configuration on the system where it is executed.
Example output:
SourceId : Microsoft.Update
PingID : 353
DownloadTimeout_Days :
GetLastDownloadSuccessTimeStamp : 1/30/2022 10:03:10 PM
DownloadRangeStart :
NumContiguousFailedDownloadsAllow : 5
UseFakeDownloadSignInIfServerInMaintenance : ONLINE_CONN_FAILURE_MOCK
PromptUpgradeReminderNotification : 30
WSUS_ServerList : {http://server1, http://server2}
TargetgroupSignature_Expired : DOWNLOAD_PROGRESS_INSTALL_WU_COMPLETED.FileMismatch
LastDownloadCompleteTimeStamp : 3/27/2022 10:02:40 PM
DontShowUIOnUnderThankNotification :
SyncStatus : 2
WUStatusServer : http://wsus:8530
RemoveUnUnnededData : 1
...
Use case 2: Send the current configuration data via email (SMTP)
Code:
Get-WUSettings -SendReport -PSWUSettings @{SmtpServer="smtp_server"; Port=smtp_port; From="sender_email"; To="receiver_email"}
Motivation:
- You may want to send the current Windows Update Agent configuration data via email to another person or your own email address, making it easier to analyze or share the information.
Explanation:
- This command retrieves the current Windows Update Agent configuration and sends it as an email report.
- The
-SendReport
parameter indicates that a report should be sent via email. - The
-PSWUSettings
parameter is used to specify additional settings for the PSWindowsUpdate module, including the SMTP server details (SmtpServer
), port (Port
), sender email address (From
), and receiver email address (To
).
Example output:
Email sent successfully to: receiver_email
Conclusion:
The Get-WUSettings
command is a powerful tool for retrieving and analyzing the current Windows Update Agent configuration. Whether you need to check the settings on your system or share the configuration data with others, this command provides a straightforward solution.