Use PowerShell to create SCCM package to upgrade Intel WIFI driver

Intel releases new Wifi driver packages from time to time to fix some security and stability related issues, such as the advisory below.

https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00448.html

Generally speaking, Intel’s Wi-Fi driver is common to all OEM manufacturers. You don’t have to go to the OEM to download a separate driver for each model. Now let’s talk about how to create a universal Wi-Fi driver upgrade package. .

  1. Download the driver package from Intel official website

    To download "Drivers for IT Admins", unzip with 7zip

       https://downloadcenter.intel.com/download/30280/Intel-PROSet-Wireless-Software-and-Drivers-for-IT-Admins

  2. Create a PowerShell script

       Driver upgrade needs to use PowerShell script to call devcon to achieve

       Install WDK and get devcon.exe

       Create a script to get the hardware ID of the WIFI, match the inf file used and call devcon to perform a silent upgrade

       code show as below

<#	
	.NOTES
	===========================================================================
	 Created with: 	SAPIEN Technologies, Inc., PowerShell Studio 2019 v5.6.166
	 Created on:   	12/10/2019 1:50 PM
	 Created by:   	sky2133
	 Organization: 	
	 Filename:     	Update-WiFi.ps1
	===========================================================================
	.DESCRIPTION
		Upgrade WiFi driver by utilizing DevCon from WDK
#>
Function Write-Log
{
	[cmdletbinding()]
	Param (
		[Parameter(Position = 0)]
		[ValidateNotNullOrEmpty()]
		[string]$Message,
		[Parameter(Position = 1)]
		[string]$LogPath = "$env:windir\Deployments\Update-WiFi.log"
	)
	
	#Pass on the message to Write-Verbose if -Verbose was detected
	Write-Verbose $Message
	
	#only write to the log file if the $LoggingPreference variable is set to Continue
	
	
	#if a $loggingFilePreference variable is found in the scope
	#hierarchy then use that value for the file, otherwise use the default
	#$LogPath
	if ($loggingFilePreference)
	{
		$LogFile = $loggingFilePreference
	}
	else
	{
		$LogFile = $LogPath
	}
	
	Write-Output "$(Get-Date) - $Message" | Out-File -FilePath $LogFile -Append
	
	
} #end function

Write-Log "Script starting to run"
write-log "................................................................................................................"
gci c:\Windows\System32\drivers\netw*.sys | % {
	
	Write-Log "Driver File: $($_.name)"
	Write-Log "Driver Version: $($(Get-ItemProperty $_).VersionInfo.Fileversion)"
}
$wifi = get-netadapter -Name Wi-Fi | select -ExpandProperty PnPDeviceID | select -First 1
$wifi_sub = $wifi.substring(22, 15)
$wifi = $wifi.substring(0, 37)

gci *.inf | select -ExpandProperty fullname | % {
	if ($(gc $_) -match $wifi_sub)
	{
		write-log "driver matched $wifi, start to upgrade...."
		.\devcon update $_  $wifi
	}
	
}
write-log "driver matched $wifi, upgrade completed"

write-log "................................................................................................................"

gci c:\Windows\System32\drivers\netw*.sys | % {
	
	Write-Log "Driver File: $($_.name)"
	Write-Log "Driver Version: $($(Get-ItemProperty $_).VersionInfo.Fileversion)"
}

The directory structure at this time is as follows

image.png










3. Create SCCM Package

Set the relevant attributes and file path

image.png















The execution command is set as follows

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile -noninteractive -executionpolicy bypass -windowstyle hidden -command ".\update-wifi.ps1"



image.png













4. Push the installation and test the installation results

After the installation is complete, you can go to the device manager to check the WIFI driver version. If there is any problem, you can open the log file "C:\windows\Deployments\Update-WiFi.log" to see the specific implementation.



image.png

Guess you like

Origin blog.51cto.com/sky2133/2678065