Created
April 7, 2012 11:42
-
-
Save tkmtmkt/2327972 to your computer and use it in GitHub Desktop.
Network Adapter Setting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$config = @" | |
"COMPUTER","IPAddress","Subnetmask","Gateway" | |
"ORANGE","192.168.0.6","255.255.255.0","192.168.0.1" | |
"BROWN", "192.168.0.7","255.255.255.0","192.168.0.1" | |
"@ | ConvertFrom-Csv | ?{$_.COMPUTER -eq $Env:COMPUTERNAME} | |
gwmi Win32_NetworkAdapterConfiguration | ?{$_.IPEnabled -eq $true -and $_.Description -match "WiFi"} | %{ | |
$_.EnableDHCP() | |
$_.EnableStatic($config.IPAddress, $config.Subnetmask) | |
$_.SetGateways($config.Gateway,1) | |
$_.SetDNSServerSearchOrder(@("192.168.0.1","192.168.0.2")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment