首页 > 系统服务 > 详细

Powershell 修改网卡配置脚本

时间:2018-04-07 17:30:51      阅读:516      评论:0      收藏:0      [点我收藏+]
$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
}

Powershell 修改网卡配置脚本

原文:http://blog.51cto.com/unicom/2095398

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!