$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 Preferred Band | 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"
Change-networkadaptersettings
}
Powershell Modify the NIC configuration script