Posted in : Microsoft, System Center By Johan Nilsson Translate with Google ⟶

5 years ago

Working with client driver packages for me is related to a never-ending story. Drivers are frequently being updated and results in manually handling updates of Driver Packages in Configuration Manager. But since some computer manufacturers are releasing updates through Windows Update, so we thought; What if you can use a Task Sequence to force Windows Update to look for updates and drivers over the Internet instead of using manually handled Driver Packages? So I decided to try with a Surface Book.
With help from the PowerShell Module PSWindowsUpdate, created by Michal Gajda (downloaded from TechNet), and with a post from Waingrositblog, I had all the necessary bits forcing a Surface Book to download drivers from Windows Update, over the Internet, while running a Task Sequence. I started by modifying the steps, created by Waingrositblog, in the Task Sequence steps a bit. I found having one step running a PowerShell script instead of three steps, two of which was running cmd lines, more suitable.

This image illustrates the Task Sequence step.


I added the update step just after applying Windows- and Network Settings, where we usually apply driver packages.
The RPS (Run PowerShell) – Microsoft Update step is running the following script:

# Beginning of the script
begin {
    # If the PowerShell Modules Folder is non-existing, it will be created.
    if ($false -eq (Test-Path $env:SystemRoot\System32\WindowsPowerShell\v1.0\Modules)) {
        New-Item -ItemType Directory -Path $env:SystemRoot\System32\WindowsPowerShell\v1.0\Modules1 -Force
    }
    # Import the PowerShell Module
    $ScriptPath = Get-Location
    Import-Module $ScriptPath\PSWindowsUpdate -Force
    # Specify the path usage of Windows Update registry keys
    $Path = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows'
}
# Updates and Driver download
process {
    # If the necessary keys are non-existing, they will be created
    if ($false -eq (Test-Path $Path\WindowsUpdate)) {
        New-Item -Path $Path -Name WindowsUpdate
        New-ItemProperty $Path\WindowsUpdate -Name DisableDualScan -PropertyType DWord -Value '0'
        New-ItemProperty $Path\WindowsUpdate -Name WUServer -PropertyType DWord -Value $null
        New-ItemProperty $Path\WindowsUpdate -Name WUStatusServer -PropertyType DWord -Value $null
    }
    else {
        # If the value of the keys are incorrect, they will be modified
        try {
            Set-ItemProperty $Path\WindowsUpdate -Name DisableDualScan -value "0" -ErrorAction SilentlyContinue
            Set-ItemProperty $Path\WindowsUpdate -Name WUServer -Value $null -ErrorAction SilentlyContinue
            Set-ItemProperty $Path\WindowsUpdate -Name WUStatusServer -Value $null -ErrorAction SilentlyContinue
        }
        catch {
            Write-Output 'Skipped modifying registry keys'
        }
    }
    # Add ServiceID for Windows Update
    Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false
    # Pause and give the service time to update
    Start-Sleep 30
    # Scan against Microsoft, accepting all drivers
    Get-WUInstall -MicrosoftUpdate -AcceptAll
    # Scaning against Microsoft for all Driver types, and accepting all
    Get-WUInstall -MicrosoftUpdate Driver -AcceptAll
    # Scanning against Microsoft for all Software Updates, and installing all, ignoring a reboot
    Get-WUInstall -MicrosoftUpdate Software -AcceptAll -IgnoreReboot
}
# End of the script
end {
    #
}

To verify the success of the script I went through the WindowsUpdateLog.Log and found that during the Task Sequence, a lot of drivers were installed. Here I would like to use PCI drivers as an example. As shown in the image below, the WindowsUpdateLog successfully downloaded and applied the drivers.

This is the WindowsUpdateLog.Log generated after successfully running the Update Drivers sequence.


I also tried the running the Task Sequence without the Windows Update / Driver script and found out the device had conflicts with the PCI drivers. These drivers is just used as an example in this process, there are several conflicts and other drivers missing as shown in the image below.

This image illustrates conflicts with, among others, the PCI drivers after not running the Update Drivers sequence.


This image illustrates when the drivers are applied.


As shown in these images, the Install Driver step running in the Task Sequence finds the correct and necessary drivers. After a Task Sequence successfully has gone through no exclamation marks are found in the Device Manager.
Some computer manufacturers are using Windows Update as a secondary source for updates, and because of this some drivers can be out of date. This is a reason why the Surface is a great example of using Windows Update for drivers since Microsoft release their updates, up to date.
If you have any questions, opinions or improvements, feel free to email me at Johan.Nilsson@Xenit.se

Tags : ConfigMgr, Driver Package, OSD, PowerShell, SCCM, Surface, Task Sequence, Windows Update

Personlig rådgivning

Vi erbjuder personlig rådgivning med författaren för 1400 SEK per timme. Anmäl ditt intresse i här så återkommer vi så snart vi kan.

Add comment

Your comment will be revised by the site if needed.