Created
December 14, 2017 19:53
-
-
Save sub314xxl/d9542ca24246699753d21d79134a6d6f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$description = "Network Name" | |
$staticIp = "" | |
$subnetMask = "" | |
$gateway = "" | |
$adapter = Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object { $_.Description -match $description} | |
$adapter | Invoke-CimMethod -Name EnableStatic -Arguments @{ IPAddress = $staticIp; SubnetMask = $subnetMask } | |
$adapter | Invoke-CimMethod -Name SetGateways -Arguments @{ DefaultIPGateway = $gateway; GatewayCostMetric = [UInt16] 1 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment