码迷,mamicode.com
首页 > 系统相关 > 详细

Powershell 修改网卡配置脚本

时间:2018-04-07 17:35:16      阅读:1016      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!