powershell 用于更新现有的无线配置文件密码。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 用于更新现有的无线配置文件密码。相关的知识,希望对你有一定的参考价值。
function Update-WirelessPassword {
[CmdletBinding()]
param(
[Parameter(Mandatory=$True)]
$Profile,
$Password
)
$Confirm = Netsh WLAN export profile name="$Profile" folder="$env:temp" key=clear
if($($Confirm | Out-String) -notlike '*success*'){
Write-Output "ERROR: $Confirm"
break
}
try{
$FilePath = (Get-ChildItem $env:temp -Filter "*$($Profile).xml")[0].FullName
[xml]$XML = Get-Content $FilePath
$XML.WLANProfile.MSM.security.sharedKey.keyMaterial = $Password
$XML.Save($FilePath)
Netsh WLAN add profile filename="$FilePath"
Remove-Item $FilePath -Force
}
catch{
Write-Output "ERROR: $($Error[0])"
}
}
以上是关于powershell 用于更新现有的无线配置文件密码。的主要内容,如果未能解决你的问题,请参考以下文章