利用PowerShell创建SCCM package升级Intel WIFI驱动

Intel时不时的发布新的Wifi驱动包来修复一些安全和稳定相关的问题,如下面这个advisory。

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

一般来说,Intel的Wifi驱动对于各个OEM厂商来说都是通用的,不必非要去OEM厂商为每个型号都下载一个单独的驱动,现在就来说一下如何创建一个通用的Wifi驱动升级包。

  1. Intel官网下载驱动包

    要下载 "Drivers for IT Admins", 用7zip解压

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

  2. 创建PowerShell 脚本

       驱动的升级需要利用PowerShell脚本调用devcon来实现

       安装WDK并获取devcon.exe

       创建脚本获取WIFI的硬件ID,match对用的inf文件并调用devcon来执行静默升级

       代码如下

<#	
	.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)"
}

此时的目录结构如下

image.png










3. 创建SCCM Package

设置好相关属性和文件路径

image.png















执行命令设置如下

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



image.png













4. 推送安装并测试安装结果

安装完成后可以到设备管理器看下WIFI的驱动版本,有什么问题的话,可以打开日志文件"C:\windows\Deployments\Update-WiFi.log" 看下具体的执行情况。



image.png

优秀的个人博客,低调大师

微信关注我们

原文链接:https://blog.51cto.com/sky2133/2678065

转载内容版权归作者及来源网站所有!

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

相关文章

发表评论

资源下载

更多资源
优质分享Android(本站安卓app)

优质分享Android(本站安卓app)

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario,低调大师唯一一个Java游戏作品

Mario,低调大师唯一一个Java游戏作品

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Apache Tomcat7、8、9(Java Web服务器)

Apache Tomcat7、8、9(Java Web服务器)

Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta 项目中的一个核心项目,由Apache、Sun 和其他一些公司及个人共同开发而成。因为Tomcat 技术先进、性能稳定,而且免费,因而深受Java 爱好者的喜爱并得到了部分软件开发商的认可,成为目前比较流行的Web 应用服务器。

Java Development Kit(Java开发工具)

Java Development Kit(Java开发工具)

JDK是 Java 语言的软件开发工具包,主要用于移动设备、嵌入式设备上的java应用程序。JDK是整个java开发的核心,它包含了JAVA的运行环境(JVM+Java系统类库)和JAVA工具。