Skip to content

Instantly share code, notes, and snippets.

@loonison123
Created April 18, 2014 22:43
Show Gist options
  • Select an option

  • Save loonison123/11067435 to your computer and use it in GitHub Desktop.

Select an option

Save loonison123/11067435 to your computer and use it in GitHub Desktop.
Disable and reconfigure a static IP address on Windows Server 2012 using powershell
# List all network adapters (Find the name)
Get-NetAdapter
# (Administrator) Disable an ethernet adapter (Won't prompt you to confirm)
Disable-NetAdapter -Name "Ethernet" -Confirm:$false
# If you want to view some IP information
Get-WmiObject -Class win32_networkadapterconfiguration -filter ipenabled=TRUE -computername .
# Set static IP
New-NetIpAddress 192.168.1.5 -InterfaceAlias "Wi-Fi" -DefaultGateway 192.168.1.1 -AddressFamily IPv4 -PrefixLength 24
# Set DNS Server
Set-DnsClientServerAddress -InterfaceAlias "Wi-Fi" -ServerAddresses 192.168.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment