Skip to main content

Patching - Check for WSUS Settings

Summary

Determines if Windows Server Update Services (WSUS) settings are configured in the registry and identifies if they are managed via Group Policy (GPO). The result is stored in the custom field WSUS_Status.

Sample Run

Sample1

Sample2

Sample3

Dependencies

CustomField - WSUS_Status Solution - Patching - Check for WSUS Settings

Task Creation

Step 1

Navigate to AutomationTasks
step1

Step 2

Create a new Script Editor style task by choosing the Script Editor option from the Add dropdown menu
step2

The New Script page will appear on clicking the Script Editor button:
step3

Step 3

Fill in the following details in the Description section:

  • Name: Patching - Check for WSUS Settings
  • Description: Determines if Windows Server Update Services (WSUS) settings are configured in the registry and identifies if they are managed via Group Policy (GPO). You can also write the results to a text custom field.
  • Category: Patching

Description Image

Script Editor

Click the Add Row button in the Script Editor section to start creating the script
AddRow

A blank function will appear:
BlankFunction

Row 1 Function: PowerShell Script

Search and select the PowerShell Script function.
Row 1 Step 1
Row 1 Step 2

The following function will pop up on the screen:
Row 1 Step 3

Paste in the following PowerShell script and set the Expected time of script execution in seconds to 600 seconds. Click the Save button.

PowerShell Script 1

PowerShell

Row 2 Logic: If/Then

  • Add a new If/Then logic from the Add Logic dropdown menu.

Image

Row 2a Condition: Output Contains

  • Type An error occurred in the Value box.

Output Contains

Row 2b Function: Script Exit

  • Add a new row in the If Section of the If/Then part by clicking the Add Row button
  • Search and select the Script Exit function.
  • Input the following:
Failed to run the WSUS Settings audit. Refer to the logs:
%Output%

Image

Script Exit

Row 3 Function: Command Prompt (CMD) Script

After End If, click on Add Row and search for Command Prompt (CMD) Script CMD

Paste in the following Command Prompt (CMD) script and set the expected script execution time to 600 seconds.

Bash Script 1

CMD Image

Row 4 Function: PowerShell Script

Click on Add Row, search and select the PowerShell Script function.
Row 1 Step 1
Row 1 Step 2

The following function will pop up on the screen:
Row 1 Step 3

Paste in the following PowerShell script and set the Expected time of script execution in seconds to 300 seconds. Click the Save button.

PowerShell Script 2

Image

Row 5 Logic: If/Then

  • Add a new If/Then logic from the Add Logic dropdown menu.

Image

Row 5a Condition: Output Contains

  • Type An error occurred in the Value box.

Output Contains

Row 5b Function: Script Exit

  • Add a new row in the If Section of the If/Then part by clicking the Add Row button
  • Search and select the Script Exit function.
  • Input the following:
WSUS Settings audit failed. %output%

Image

Script Exit

Row 6 Function: Script Log

  • Add a new row by clicking the Add Row button after End If
  • Search and select the Script Log function.
  • Input the following:

Bash Script 2

Image

Script Log

Row 7 Function: Set Custom Field

  • Add a new row by clicking the Add Row button
  • Search and select the Set Custom Field function.
  • Input the following:

Custom field set

Custom field set 1

Save Task

Click the Save button at the top-right corner of the screen to save the script.
SaveButton

Completed Task

Complete

Output

  • Log
  • local file

C:\ProgramData\_Automation\Script\Audit-WSUSSettings\Audit-WSUSSettings-log.txt

C:\ProgramData\_Automation\Script\Audit-WSUSSettings\Audit-WSUSSettings-error.txt

Changelog

2025-08-01

  • Initial version of the document