kindly help me with complete steps I am new to PowerShell or scripting
I am looking script to capture dns server ip address preferred and alternative DNS servers. scanrio is I have list of server list or csv format so how to capture dns ip address details (preferred and alternative DNS servers) . it requires to administrative rights on all servers? or only administrative rights on single server so I can ran script kindly help me with complete steps I am new to PowerShell or scripting
August 29th, 2015 1:18am

Sorry we do not do that here. We can answer questions about scripting but you must learn how to write a script on your own.

Start here: https://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx?f=255&MSPPError=-2147217396

You can find pre-written scripts here: https://gallery.technet.microsoft.com/ScriptCenter/

You must be an admin on all servers or you must log in local (at the console) of all servers.

Free Windows Admin Tool Kit Click here and download it now
August 29th, 2015 2:43am

I am not clear please be specific "You must be an admin on all servers or you must log in local (at the console) of all servers"

August 29th, 2015 12:06pm

I tried below script but it is t capturing advanced TCP/ip settings all list of DNS server address . it possaible to capture only preferred and alternative DNS server again how to change preferred and alternative DNS server via script I am for that script also

Get-Content .\servers.txt | `
ForEach-Object {
  Get-WMIObject Win32_NetworkAdapterConfiguration -Computername $_ | `
  Where-Object {$_.IPEnabled -match "True"} | `
  Select-Object -property DNSHostName,@{N="DNSServerSearchOrder";
                                    E={"$($_.DNSServerSearchOrder)"}},
                                    @{N='IPAddress';E={$_.IPAddress}}
} | Export-CSV -path servers.csv -NoTypeInformation

Free Windows Admin Tool Kit Click here and download it now
August 29th, 2015 1:25pm

Order is order.  It is what you have in the results:

PS C:\scripts> $dns=Get-WMIObject Win32_NetworkAdapterConfiguration -filter 'ipenabled=true'|select -expand dnsserversearchorder
PS C:\scripts> $dns[0]
75.75.75.75
PS C:\scripts> $dns[1]
75.75.76.76
August 29th, 2015 2:14pm

Thanks now my question about how to set new DNS servers IP's sceanrio i have set of servers frist thing is needs to capture DNS IP details secaond requirment is set new DNS server IP address kindly help me for both sceanrio i am new to powershell
Free Windows Admin Tool Kit Click here and download it now
August 30th, 2015 7:34am

You can easily go to the setting tab on the Network Adapter settings page.  You can  also read the documentation on the WMI class to learn how to use it.

Here are the docs: https://msdn.microsoft.com/en-us/library/aa394217%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

All of WMI and PowerShell are documented this way.  When someone takes basic classes and training in Windows they learn how to look up things in the documentation.  This is a must for anyone wanting to be a technician. 

End users should stick to the GUI and ask questions here: http://answers.microsoft.com . This forum is not a help desk or an end user support forum. You are expected to know or be learning scripting and Windows technologies.  If you have specific product questions then post in the associated product forum.  In  your case I would post in the networking forum. If you are trying to become a technician then read the link on the WMI class.  All WMI classes are documented this way.  Most of PowerShell is based on two things ... the Net Framework  and ... WMI (CIM).  Both are extensively documented on the Internet.

August 30th, 2015 8:00am

Thanks i am looking simple script to help me to full fill the requirement just one script for capturing DNS information from list of servers (already i tried it working looking better script)second one setting dns server (preferred and alternative dns information) via script search for that 
Free Windows Admin Tool Kit Click here and download it now
August 30th, 2015 12:28pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics