Skip to main content

Feature Update Install With Tracking

Summary​

The script initiates the latest Feature Update using the Upgrade Assistant and records the attempt in the custom field WinFeatUpgradeAttempts. In case of failure, it updates the Feature Update Install Failure custom field with the error message. If the upgrade completes without error but a reboot is pending, the Feature Update Reboot Pending custom field is updated.

The script compares the current operating system build with the latest available build before and after the upgrade, with the latest build requiring manual entry into the script. For any new releases, the build number must be manually set in the script at step 2 for Windows 11 and step 3 for Windows 10.

Image

Parameters:

  • Reboot - If True: Will reboot the device immediately after the upgrade completes.
  • Reset - If True: Will reset the tracker counter to 0.

Sample Run​

Image

User Parameters​

  • Reboot - If True: Will reboot the device immediately after the upgrade completes.
  • Reset - If True: Will reset the tracker counter to 0.

Image

Dependencies​

Create Script​

Create a new Script Editor style script in the system to implement this task.

Image

Image

Name: Feature Update Install With Tracking

Description: Attempts latest Feature Update using the Upgrade Assistant. Tracks attempt into Custom Field WinFeatUpgradeAttempts. Parameters: Reboot - If True: Will reboot the device immediately after the upgrade completes. Reset - If True: Will reset tracker counter to 0.

Category: Patching

Image

Parameters​

Click the Add Parameter button.

Image

The Add New Script Parameter box will appear.

Image

In the box, fill in the following details and select Save to create the Reboot parameter.

Image

Add another parameter and fill in the following details to create the Reset parameter.

Image

Script​

Start by adding a row. You can do this by clicking the Add Row button at the bottom of the script page.

Image

Row 1 Function: Script​

Choose Script from the dropdown menu; by default, it will show Function.

Image

Search for the Windows Feature Update Attempt Tracking (Subscript) and select it.

Image

NOTE: Make sure to select the 'Continue on Failure' checkbox.

Row 2 Function: Set User Variable​

Insert a new row by clicking the Add Row button.

Image

Select Set User Variable function.

Image

Image

Image

Type Win11LatestBuild in the Variable Name field and 10.0.26100 in the Value field. 10.0.26100 is the latest available feature build for Windows 11 at the moment. Click Save to create the Win11LatestBuild variable.

Image

Image

Row 3 Function: Set User Variable​

Insert a new row by clicking the Add Row button.

Image

Select Set User Variable function.

Image

Image

Image

Type Win10LatestBuild in the Variable Name field and 10.0.19045 in the Value field. 10.0.19045 is the latest available feature build for Windows 10 at the moment. Click Save to create the Win10LatestBuild variable.

Image

Image

Row 4 Function: PowerShell Script​

Insert a new row by clicking the Add Row button.

Image

Select PowerShell Script function.

Image

Image

Image

Paste in the following PowerShell script, set the expected time of script execution to 300 seconds, and click the Save button.

PowerShell Script 1

Image

Mark the Continue on Failure checkbox.

Image

Row 5 Logic: If Then​

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

Image

Image

Row 5a Condition: Output Contains​

Type True in the Value box and press Enter.

Image

Row 5b Function: Script Log​

Insert a new row by clicking the Add Row button inside the If Then logic after the Output Contains condition.

Image

Search and select the Script Log function in the new row.

Image

Image

Paste this line in the Script Log Message box and click the Save button.

The machine has already been updated to the latest feature build available for the operating system.

Image

Image

Row 5c Function: Script Exit​

Insert a new row by clicking the Add Row button inside the If Then logic after the Script Log function.

Image

Search and select the Script Exit function in the new row.

Image

Image

Image

Row 6 Function: PowerShell Script​

Insert a new row by clicking the Add Row button.

Image

Select PowerShell Script function.

Image

Image

Image

Paste in the following PowerShell script, set the expected time of script execution to 7200 seconds, and click the Save button.

PowerShell Script 2

Image

Mark the Continue on Failure checkbox.

Image

Row 7 Function: Script Log​

Insert a new row by clicking the Add Row button.

Image

Select Script Log function.

Image

Image

Paste this line in the Script Log Message box and click the Save button.

Script Output: %output%

Image

Image

Row 8 Function: PowerShell Script​

Insert a new row by clicking the Add Row button.

Image

Select PowerShell Script function.

Image

Image

Image

Paste in the following PowerShell script, set the expected time of script execution to 300 seconds, and click the Save button.

$workingpath = "$env:ProgramData/_automation/Script/FeatureUpdate"
$logpath = "$workingpath/Install-FeatureUpdate-log.txt"
if ( Test-Path $logpath ) {
Get-Content $logpath
} else {
return 'Log File not found.'
}

Image

Mark the Continue on Failure checkbox.

Image

Row 9 Function: Script Log​

Insert a new row by clicking the Add Row button.

Image

Select Script Log function.

Image

Image

Paste this line in the Script Log Message box and click the Save button.

Log Content: %output%

Image

Image

Row 10 Function: PowerShell Script​

Insert a new row by clicking the Add Row button.

Image

Select PowerShell Script function.

Image

Image

Image

Paste in the following PowerShell script, set the expected time of script execution to 300 seconds, and click the Save button.

PowerShell Script 3

Image

Mark the Continue on Failure checkbox.

Image

Row 11 Logic: If Then​

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

Image

Image

Row 11a Condition: Output Does Not Contain​

In the Output Contains condition, select the Does Not Contain condition from the drop-down menu, type Error Log File not found in the input value or variable box, and press Enter.

Image

Row 11b Logic: If Then​

Insert a new If/Then logic from the Add Logic dropdown menu after the Output Does Not Contain condition.

Image

Row 11b(i) Condition: Output Contains​

In the Output Contains condition, type The volume health check returned a negative result in the input value or variable box and press Enter.

Image

Row 11b(ii) Function: Set Custom Field​

Click the Add Row button inside the internal If Then logic to add a new function.

Image

Search and select the Set Custom Field function.

Image

Image

Search and select the Feature Update Install Failure custom field.

Image

Type Volume Health Error in the Value box and click the Save button.

Image

Image

Row 11c Logic: If Then​

Insert a new If/Then logic inside the external If Then logic from the Add Logic dropdown menu.

Image

Row 11c(i) Condition: Output Contains​

In the Output Contains condition, type The Windows Update health check returned a negative result in the input value or variable box and press Enter.

Image

Row 11c(ii) Function: Set Custom Field​

Click the Add Row button inside the internal If Then logic to add a new function.

Image

Search and select the Set Custom Field function.

Image

Image

Search and select the Feature Update Install Failure custom field.

Image

Type Health Check Error in the Value box and click the Save button.

Image

Image

Row 11d Logic: If Then​

Insert a new If/Then logic inside the external If Then logic from the Add Logic dropdown menu.

Image

Row 11d(i) Condition: Output Contains​

In the Output Contains condition, type The Drive Space health check failed in the input value or variable box and press Enter.

Image

Row 11d(ii) Function: Set Custom Field​

Click the Add Row button inside the internal If Then logic to add a new function.

Image

Search and select the Set Custom Field function.

Image

Image

Search and select the Feature Update Install Failure custom field.

Image

Type Low Drive Space Error in the Value box and click the Save button.

Image

Image

Row 11e Logic: If Then​

Insert a new If/Then logic inside the external If Then logic from the Add Logic dropdown menu.

Image

Row 11e(i) Condition: Output Contains​

In the Output Contains condition, type incompatible with windows 11 upgrade in the input value or variable box and press Enter.

Image

Row 11e(ii) Function: Set Custom Field​

Click the Add Row button inside the internal If Then logic to add a new function.

Image

Search and select the Set Custom Field function.

Image

Image

Search and select the Feature Update Install Failure custom field.

Image

Type Compatibility Check Error in the Value box and click the Save button.

Image

Image

Row 11f Logic: If Then​

Insert a new If/Then logic inside the external If Then logic from the Add Logic dropdown menu.

Image

Row 11f(i) Condition: Custom Field Does Not Contain​

Select Custom Field option from the first dropdown menu of the output contains condition.

Image

Search and select the Feature Update Install Failure custom field.

Image

Select the Does Not Contain condition from the condition's dropdown menu.

Image

Type Error in the comparison field.

Image

Add another condition by clicking the Add Condition button.

Image

Type Error Log File not found in the Input Value or Variable box and press Enter.

Image

Row 11f(ii) Function: Set Custom Field​

Click the Add Row button inside the internal If Then logic to add a new function.

Image

Search and select the Set Custom Field function.

Image

Image

Search and select the Feature Update Install Failure custom field.

Image

Type Installation Failure/Error in the Value box and click the Save button.

Image

Image

Row 11g Function: Script Exit​

Click the Add Row button inside the external If Then logic to add a new function.

Image

Select the Script Exit function.

Image

Type Error Log Content: %Output% in the Error Message field and click the Save button.

Image

Image

This is how Step 11 should look after completion.

Image

Step 12 Logic: If Then Else​

Add a new If/Then/Else logic from the Add Logic dropdown menu. Make sure to not click on the one that is part of row 11.

Image

Image

Step 12a Condition: Value Equals​

Select Value from the first dropdown menu in the Output Contains condition.

Image

Type %reboot% and press enter in the Enter Value field.

Image

Select Equals from the condition dropdown menu.

Image

Type True and press Enter in the Input Value or Variable field.

Image

Image

Step 12b Function: PowerShell Script​

Add a new row in the If section by clicking the Add Row button.

Image

Image

Search and select the PowerShell Script in the newly added row.

Image

Image

Paste in the following PowerShell script, set the expected time of script execution to 300 seconds, and click the Save button.

shutdown /f /r /t 00

Image

Mark the Continue on Failure checkbox.

Image

Step 12c Function: PowerShell Script​

Add a new row in the If section by clicking the Add Row button.

Image

Image

Search and select the PowerShell Script in the newly added row.

Image

Image

Paste in the following PowerShell script, set the expected time of script execution to 610 seconds, and click the Save button.

Start-Sleep 600

Image

Mark the Continue on Failure checkbox.

Image

Step 12d Function: PowerShell Script​

Add a new row in the If section by clicking the Add Row button.

Image

Image

Search and select the PowerShell Script in the newly added row.

Image

Image

Paste in the following PowerShell script, set the expected time of script execution to 300 seconds, and click the Save button.

PowerShell Script 4

Image

Mark the Continue on Failure checkbox.

Image

This is how Step 12 should look after adding the above-mentioned PowerShell script steps.

Image

Completed Script​

Step 1:

Image

Step 2:

Step 3:

Image

Step 4:

Image

Step 5:

Image

Step 6:

Image

Step 7:

Image

Step 8:

Image

Step 9:

Image

Step 10:

Image

Step 11:

Image

Image

Image

Step 12:

Image

Image

Image

Deployment​

  • Go to Automation > Tasks.
  • Search for Feature Update Install with Tracking Task.
  • Select the concerned task.
  • Click on the Schedule button to schedule the task/script.

Image

This screen will appear.

Image

Click the Does not repeat button.

Image

This pop-up box will appear.

Image

Click the OK button to run the task once per day.

Image

Select the relevant time to execute the script. It is suggested to run this task after hours.

Image

Leave the parameters as they are unless your requirement is to restart the computer forcefully. Select True for the Reboot parameter to restart the computer during script run. Be careful with the script run time, especially with the Reboot parameter set to True.

Image

Search and select the Feature Pack Update Automation group in the Resources.

Image

Clicking the Run button will initiate the schedule.

Image

The task will start appearing in the Scheduled Tasks.

Image

Image

The Suspend option can be used to suspend/stop the schedule.

Image

Image

Output​

  • Script Log
  • Custom Field

Changelog​

2025-04-10​

  • Initial version of the document