20200630--Powershell禁用网卡节能模式

 1 $searchText ="LsoV2IPv4"
 2 $Regpath = "HKLM:\SYSTEM\CurrentControlSet\Control\Class"
 3 
 4 Get-ChildItem $Regpath -Recurse -ErrorAction SilentlyContinue | 
 5     ForEach-Object { 
 6         if((get-itemproperty -Path $_.PsPath) -match $searchText)
 7         { 
 8             $_.PsPath
 9             ForEach-Object {
10             Set-ItemProperty -Path $_.PsPath -Name PnPCapabilities -Value "24"  -ErrorAction Continue
11             }
12         } 
13     } 
14 Get-NetAdapter -Name '以太网' | Restart-NetAdapter

 

posted on 2020-06-30 14:49  没什么事我就先挂了  阅读(417)  评论(0)    收藏  举报