INTRODUCING DRIVERS AS A SERVICE VERSION 1.0.0

This is the first version of what I like to call “Drivers as a Service”, a PowerShell developed solution that provides continuous automatic updating of drivers on supported hardware platforms. The solution consists of the following;

 

For more information visit http://www.scconfigmgr.com/2018/11/22/drivers-as-a-service-version-1-0-0-released

Feedback

As always, test in isolation and if you find bugs, or have feedback please do so here.

 

 

 Execution notifications;

 


Extract of PowerShell code;

PowerShell
Edit|Remove
function StartDaaS { 
    try { 
        # Wait for Drivers as a Service service 
        Write-CMLogEntry -Value "Checking for ConfigMgr client service (CCMEXEC)" -Severity 1 
        $SCCMServiceStatus = Get-Service -Name "CCMEXEC" | select -Property Name, StartType 
        if ((!([string]::IsNullOrEmpty($SCCMServiceStatus.Name))) -and (($SCCMServiceStatus.StartType) -match "Automatic")) { 
            $ConfigMgrInstalled = $true 
            Write-CMLogEntry -Value "System is currently managed by ConfigMgr" -Severity 1 
            while ((Get-Service -Name "CCMEXEC" | select -ExpandProperty Status) -ne "Running") { 
                # Wait for ConfigMgr client service to start 
                Write-CMLogEntry -Value "Waiting for ConfigMgr client service (CCMEXEC) to start" -Severity 1 
                Start-Sleep -Seconds 15 
            } 
            CheckConfigMgrClient 
        } 
        else { 
            $ConfigMgrInstalled = $false 
            global:Write-CMLogEntry -Value "No ConfigMgr client found" -Severity 1 
        } 
         
        if ($ConfigMgrInstalled -eq $true) { 
            if ($ConfigMgrAllowIntranetDL -eq $false) { 
                # Run Modern Driver Management task sequence 
                if (!([string]::IsNullOrEmpty($ConfigMgrPkgID))) { 
                    Write-CMLogEntry -Value "Starting driver update process with SCCM (Package $($ConfigMgrPkgID))" -Severity 1 
                    RunDriverUpdateTS -ConfigMgrPkgID $ConfigMgrPkgID 
                } 
                else { 
                    Write-CMLogEntry -Value "Attempting to find driver update task sequence" -Severity 1 
                    $TaskSequenceID = Get-WmiObject -Class CCM_Program -Namespace ROOT\ccm\ClientSDK | select -Property PackageName, PackageID | Where-Object { 
                        $_.PackageName -eq "Update Windows Drivers" 
                    } | select -ExpandProperty PackageID 
                    if (!([string]::IsNullOrEmpty($TaskSequenceID))) { 
                        Write-CMLogEntry -Value "Task sequuence ID identified as: $($TaskSequenceID)" -Severity 1 
                        if (!([string]::IsNullOrEmpty($TaskSequenceID))) { 
                            Write-CMLogEntry -Value "Starting driver update process with SCCM (Package $($TaskSequenceID))" -Severity 1 -HostOutput $true 
                            RunDriverUpdateTS -ConfigMgrPkgID $TaskSequenceID 
                        } 
                    } 
                    else { 
                        Write-CMLogEntry -Value "Unable to find required task sequence. DaaS will not update this system, please review the installation documentation for more details." -Severity 3 
                    } 
                } 
            } 
            else { 
                Write-CMLogEntry -Value "Internet downloads enabled on local intranet by administrative setting. Use with caution" -Severity 2 
                # Start Toast Notifications 
                CheckStatusMessages 
            } 
        } 
        else { 
            # Start Toast Notifications 
            CheckStatusMessages 
        } 
        # Invoke sleep mode 
        SleepTrayApp 
    } 
    catch { 
        Write-CMLogEntry -Value "Error: $($_.Exception.Message)" -Severity 3 
    } 
}