terte 发表于 2018-4-9 10:38:29

Powershell 修改网卡配置脚本

                                                $ComputerName = hostname
$OS_Version = (Get-WmiObject -class win32_operatingsystem -computer $ComputerName).version
$regPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002BE10318}'
Function Change-NetworkAdapterSettings()
{
Get-NetAdapterAdvancedProperty -DisplayName 首选频带 | set-NetAdapterAdvancedProperty -RegistryValue 2
}
Function UPdate-REGSettings()
{
Get-ChildItem $regPath| foreach {         $product =Get-ItemProperty $_.PSPath
if($product.NetType -eq 'WLAN' )
{
Set-ItemProperty$product.PSPath -Name "RoamingPreferredBandType" -Value 2
}
}
}
if (($OS_Version -like "6.*"))
{
write-host "Computer Name:"$ComputerName
write-host "OS:Windows 7"
UPdate-REGSettings
}
elseif ($OS_Version -like "10.*")
{
write-host "OS:Windows 10"
Change-NetworkAdapterSettings
}

                                       

zhangxiajun 发表于 2018-4-23 09:15:46

不错,给力
页: [1]
查看完整版本: Powershell 修改网卡配置脚本