Powershell 修改網卡配置腳本

$ComputerName = hostname
$OS_Version = (Get-WmiObject -class win32_operatingsystem -computer $ComputerName).version
$regPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002BE10318}'ide

Function Change-NetworkAdapterSettings()
{
Get-NetAdapterAdvancedProperty -DisplayName 首選頻帶 | set-NetAdapterAdvancedProperty -RegistryValue 2
}code

Function UPdate-REGSettings()
{it

Get-ChildItem $regPath| foreach {

  $product =  Get-ItemProperty $_.PSPath
if($product.NetType -eq 'WLAN' )
{
Set-ItemProperty $product.PSPath -Name "RoamingPreferredBandType" -Value 2
}
}
}io

if (($OS_Version -like "6.*"))
{
write-host "Computer Name:"$ComputerName
write-host "OS:Windows 7"
UPdate-REGSettingsclass

}
elseif ($OS_Version -like "10.*")
{
write-host "OS:Windows 10"
Change-NetworkAdapterSettings
} dva

相關文章
相關標籤/搜索