4

I'm trying to figure out why "netsh dump" produces different scripts on 2003 versus 2008. In output below, I've used "netsh interface ip dump" to keep the length of this post reasonable. I've searched the full dump, and the DNS settings have not moved outside of the "interface ip" context.

Specifially why the 2008 dump does not include the DNS settings? Also seems strange that the 2008 dump does not include a "gateway" setting on the "set address" command
Does the "nexthop" setting in the 2008 output replace the "gateway" setting of 2003?

It's easy enough to write your own script, if you want the same settings everywhere But I would like to use this to backup the config on servers with unusual NIC configs in different DMZ's where I'm not sure I completely trust some of the app owners who are administrators to not some day make their own NIC changes. So I'm not just looking for one config script that I create manually and run on hundreds of targets. It seems like NETSH DUMP should be able to produce a backup of the current NIC configuration on a specific server, and thats what I'm looking for.

I've searched the kb, and see there are numerous articles for issues with NETSH The following two had hotfixes that I applied hoping there was some hidden overlap with my issue. However I still have the problem after they have been applied
http://support.microsoft.com/kb/979101
http://support.microsoft.com/kb/2472264

Thanks

# ----------------------------------
# IPv4 Configuration    from static 2008 R2 SP1
# ----------------------------------
pushd interface ipv4
reset
set global icmpredirects=enabled
add route prefix=0.0.0.0/0 interface="Local Area Connection" nexthop=10.9.8.7 publish=Yes
add address name="Local Area Connection" address=10.9.8.6 mask=255.255.255.0
popd
# End of IPv4 configuration

# ---------------------------------- 
# Interface IP Configuration    from static 2003 Sp2   
# ---------------------------------- 
pushd interface ip
# Interface IP Configuration for "Local Area Connection"
set address name="Local Area Connection" source=static addr=10.9.8.7 mask=255.255.255.0
set address name="Local Area Connection" gateway=10.9.8.6 gwmetric=0
set dns name="Local Area Connection" source=static addr=10.9.8.1 register=PRIMARY
add dns name="Local Area Connection" addr=10.9.8.2 index=2
popd
# End of interface IP configuration
Clayton
  • 4,483
  • 16
  • 24

2 Answers2

2

Yeah, this is really unfortunate. I have no idea why Microsoft omits the DNS settings in netsh dump in 2008+.

Unfortunately I think all you can do is split your process into two separate operations now... a netsh dump followed by a netsh interface ipv4 show dns... Of course I realize that this defeats the purpose of exporting and importing the configuration in an automated way. You'll have to write something custom I'm afraid.

It's not fixed in Win8/Server 2012 either. Microsoft is migrating away from netsh in general and going full Powershell, so don't hold your breath waiting for them to fix netsh.

netsh

Ryan Ries
  • 55,011
  • 9
  • 138
  • 197
0

Craig, not to hijack your question on how to get the information using netsh. I don't know why it would be different to be honest. Yes, nexthop is the same as gateway, but that doesn't fully answer the question I guess.

I Just didn't have room/formatting to place this as a comment, but maybe it will help you in your endeavor.

You could setup a Powershell script using WMI calls to get the info you need and back it up to a .csv or similar.

For instance you could use:

PS Z:\> Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName . | Select-Object PSComputerName, Description, DHCPEnabled, DHCPServer, DNSDomain, DNSDomainSuffixSearchOrder, DNSHostName, DNSServerSearchOrder, IPAddress, DefaultIPGateway, IPSubnet

The dot (.) after -ComputerName is just for grabbing the local. You could create a small input file of computers/servers and do a "For Each" and get the output you desire.

An example output from my local computer is as follows:

PSComputerName             : LT
Description                : Lenovo USB Ethernet
DHCPEnabled                : True
DHCPServer                 : 10.10.2.10
DNSDomain                  : mdmarra.local
DNSDomainSuffixSearchOrder : {mdmarra.local}
DNSHostName                : LT
DNSServerSearchOrder       : {10.10.2.10}
IPAddress                  : {10.168.9.107, fe80::8c59:4c45:c852:3c91}
DefaultIPGateway           : {10.168.9.1}
IPSubnet                   : {255.255.255.0, 64}
TheCleaner
  • 32,352
  • 26
  • 126
  • 188
  • There are many ways to get the info. WMI, Ipconfig, etc... But the key for me here is that the NETSH dump/exec script provides a quick and easy way to *recover* that config. – Clayton Sep 19 '13 at 18:48
  • I actually figured you'd say that. But how often can such basic info change that recovering manually isn't just as quick? Again, no harm meant, just didn't have the room in a comment to say what I thought might help. Hope you find the real answer! – TheCleaner Sep 19 '13 at 18:50