Tuesday, 28 November 2017 08:44

Fixing "Windows update reboot is pending" during OSD

Written by
Rate this item
(2 votes)

image

Automated OS deployment became common as IT professionals install systems using tools like Microsoft Deployment Toolkit or System Center Configuration Manager. In most cases, deploying Windows OS is fairly straightforward if you follow established best practices. However, there are still issues out there that may catch you off guard and you will suffer the consequences of task sequences misbehaving.

For instance, I’ve seen questions from people on TechNet that have run into the pending reboot issue. I myself experienced it first hand during last week's customer's engagement. Based on a quick Web search, there’s little clear help for fixing it, so in this post, I’ll give you easy steps you can follow to remedy the most common cause of this behavior.

My particular case opened when I helped a customer transition to an MDT task sequence based on current best-practices for deploying Windows 10, including automated driver management. During deployment we noticed, that Autodesk DWG TrueView 2018 installation was not being executed properly - while Autodesk DWG TrueView 2018 setup exited with return code 0, the program was not being installed on the test system (a Lenovo Miix 510). I started investigating.

From my past experiences I knew that most Autodesk programs write a log file into the %temp% directory, so I navigated to the folder, located the DWG TrueView 2018 - English Setup.log log file and opened it:

2017/11/10:12:06:45	Administrator	MDT-DEMO-2	=== Setup started on MDT-DEMO-2 by Administrator ===
2017/11/10:12:06:45	Administrator	MDT-DEMO-2	Path_Length: 135
2017/11/10:12:06:45	Administrator	MDT-DEMO-2	Current Directory \\MDT01\DeploymentShare$\Applications\Autodesk DWG TrueView 2018 11.0.31.0\Source
2017/11/10:12:06:45	Administrator	MDT-DEMO-2	Launch 
2017/11/10:12:06:45	Administrator	MDT-DEMO-2	CommandLine	/q /w /i setup.ini		
2017/11/10:12:06:45	Administrator	MDT-DEMO-2	Setup	Windows update reboot is pending		
2017/11/10:12:06:45	Administrator	MDT-DEMO-2	Setup	Autodesk® DWG TrueView™ 2018 - English	Will restart automatically.	
2017/11/10:12:06:45	Administrator	MDT-DEMO-2	=== Setup ended ===

The reason why setup was not installing Autodesk DWG TrueView 2018 was a pending Windows update reboot. This was unexpected, as we already set the ProtectYourPC value, which specifies whether Windows Update installs important and recommended updates automatically, to 3 (= automatic protection is disabled and MDT is in full control as to when Windows Update runs). But there's one other issue that we run into, especially if the task sequence doesn’t run for very long in the State Restore phase: Windows Update can automatically download and install recommended drivers and detailed information for many devices (such as network adapters, monitors, printers, and video cards). While this may be a good way to make sure all devices work properly, this default behavior can break OSD task sequence.

Sure enough, when I checked Windows Update history, I noticed that an update for Intel(R) HD Graphics driver was automatically downloaded and installed while the TS was running. This was caused by the customer not including up-to-date GPU drivers in the deployment share, which in turn triggered Windows Update to find and install the applicable driver from Microsoft.

Aside from the obvious (e.g. fixing Out-of-Box drivers repository), I advised the customer to disable automatic update process via a registry tweak. Windows Update provides options to control whether to download and install driver upgrades automatically or manually. The admin added this to Unattend.xml right before the </RunSynchronous> tag: 

<RunSynchronousCommand wcm:action="add">
 <Description>disable driver update</Description>
 <Order>5</Order>
 <Path>reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching /v SearchOrderConfig /d 0 /t REG_DWORD /f</Path>
</RunSynchronousCommand>

Note: Possible options are: 0 = 'No, let me choose what to do - Never install driver software from Windows Update', 1 = 'Yes, do this automatically (recommended)', 2 = 'No, let me choose what to do - Install driver software from Windows Update if it is not found on my computer.'

The case was closed since with that in place, Windows will no longer automatically download and install drivers through Windows Update.

We also added a script towards the end of the task sequence to - among other things - reset the driver update policy. I am including a sample script below:

# Determine where to do the logging 
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment 
$logPath = $tsenv.Value("LogPath") 
$logFile = "$logPath\$($myInvocation.MyCommand).log"

# Start the logging 
Start-Transcript $logFile
Write-Host "Logging to $logFile"

# ---------------------------------------------------------------------------
# Main logic
# ---------------------------------------------------------------------------

Write-Host "Resetting driver update policy to Microsoft's default value..."
New-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" -Name "SearchOrderConfig" -Value 1 -Type DWORD -Force | Out-Null

Stop-Transcript

As a rule of thumb, always undo the damage you are inflicting upon recommended configuration, as this hilarious Twitter exchange will teach you:

Read 1964 times Last modified on Tuesday, 28 November 2017 08:59
  1. Comments (0)

  2. Add yours
There are no comments posted here yet

Leave your comments

Posting comment as a guest.
0 Characters
Attachments (0 / 3)
Share Your Location

Recent Posts

  • Yet Another Windows 10 Optimization Script
    As a reminder, Microsoft will be ending support for Windows 7 SP1 on January 14, 2020. I've had multiple enterprise…
    Written on Monday, 25 June 2018 16:09
  • Automating Dell BIOS Configuration Using MDT
    It’s been a busy couple of weeks for me, so I’m slowly going through a backlog of things to cover.…
    Written on Thursday, 21 June 2018 08:11
  • Configuring HP BIOS Using MDT
    This is the second post in my series that explores one of the most common questions I’ve been asked from…
    Written on Tuesday, 19 June 2018 09:54
  • BIOS to UEFI - The Easy Way: MBR2GPT
    This article is the first blog post in a series I'll write over the coming days that will provide a…
    Written on Monday, 11 June 2018 17:08
  • Force LAPS Password Reset during MDT OSD
    My customers often send me exciting cases. This particular one is especially interesting because it is common in infrastructures that…
    Written on Friday, 08 June 2018 10:10
  • Localizing Inbox Apps during OSD
    As a reader of this blog, I suspect that most of you, like me, are frequenting Twitter. And I bet…
    Written on Monday, 04 June 2018 18:18