Guest User

Untitled

a guest
Dec 17th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. $description = "Network Name"
  2. $staticIp = ""
  3. $subnetMask = ""
  4. $gateway = ""
  5. $adapter = Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object { $_.Description -match $description}
  6. $adapter | Invoke-CimMethod -Name EnableStatic -Arguments @{ IPAddress = $staticIp; SubnetMask = $subnetMask }
  7. $adapter | Invoke-CimMethod -Name SetGateways -Arguments @{ DefaultIPGateway = $gateway; GatewayCostMetric = [UInt16] 1 }
Add Comment
Please, Sign In to add comment