Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

PowerShell Set DNS Settings

Posted on September 24, 2015October 16, 2015 By David Kittell

This only works on Windows 8, 8.1, 10 as the Cmdlets Set-DnsClientServerAddress Get-DnsClientServerAddress are introduced in Windows 8.

First get the interface name(s) you want to modify

Get-DnsClientServerAddress

Change the code below to the interface you wish to change

$primarydns = $args[0]
$secondarydns = $args[1]

Set-DNSClientServerAddress –interfaceAlias Wi-Fi –ServerAddresses ($primarydns,$secondarydns)
Get-DnsClientServerAddress -InterfaceAlias Wi-Fi
.\UpdateDNS.ps1 8.8.8.8 8.8.4.4   
Originally Posted on September 24, 2015
Last Updated on October 16, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code PowerShell

Post navigation

Previous post
Next post

Related Posts

MySQL Server Information

Posted on September 11, 2015

SHOW VARIABLES; SHOW STATUS; select version(); SHOW STATUS provides server status information like Connections, Opened_tables, Bytes_received, Bytes_sent, etc. SHOW VARIABLES shows the values of MySQL system variables like time_zone, version, max_connections, etc. References: http://stackoverflow.com/questions/3939803/how-to-get-mysql-server-info-using-command-line All information on this site is shared with the intention to help. Before any source code…

Read More

PowerShell – Enable WinRM

Posted on September 5, 2017September 5, 2017

Not recommended for production computers but this will get the WinRM working on a development computer. Enable-PSRemoting -Force Set-WSManQuickConfig -SkipNetworkProfileCheck winrm set winrm/config/client/auth ‘@{Basic="true"}’ winrm set winrm/config/service/auth ‘@{Basic="true"}’ winrm set winrm/config/service ‘@{AllowUnencrypted="true"}’ Set-Item wsman:\localhost\client\trustedhosts * Winrm enumerate winrm/config/listener Restart-Service WinRM New-NetFirewallRule -DisplayName "Windows Remote Management (HTTPS-In)" -Name "Windows Remote Management…

Read More

Mac OSX – Update DNS Based On WiFi

Posted on June 8, 2016June 8, 2016

I often have to bounce between WiFi at the office and the public WiFi so I finally put this script together. You will need to get the BSSID of your WiFi connection to replicate this but here is the code, of course you need to run this with sudo privileges…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes