Skip to content

Instantly share code, notes, and snippets.

@tkmtmkt
Created April 7, 2012 11:42
Show Gist options
  • Save tkmtmkt/2327972 to your computer and use it in GitHub Desktop.
Save tkmtmkt/2327972 to your computer and use it in GitHub Desktop.
Network Adapter Setting
$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