I'd like to create a script that will toggle between setting the DNS settings of my wireless card between automatic selection and a开发者_运维技巧 particular IP (openDNS).
Can this be done, and if so what should I look in to?
Thanks!
I personally would look at Powershell to do this. I found a post on how to change your ip settings in a one liner.
Get-WmiObject -class win32_networkadapterconfiguration | where-object -filterscript { $_.IPEnabled -eq ‘True’ -and $_.ServiceName -eq ‘E100B’ } | foreach-object -process { $_.EnableStatic(’192.168.1.200′,’255.255.0.0′) }
Author of this code's original post
I would use netsh (google for it)
Thanks for the link back. Here is some info that may be helpful:
Still Very Much Alive and Kicking - netsh
Tutorial PowerShell v3: TCP/IPv4 (and IPv6) Network Basics - Part I and Part II
精彩评论