TCP/IP configuration w/ python on Win2k?

Pieter Claerhout Pieter_Claerhout at
Fri May 11 03:04:07 EDT 2001

There might be another possibility. Take a look at the netsh command from
Windows. It allows you to dump the current network configuration, and load
it again. It works like:

D:\>netsh interface dump
D:\>netsh exec my_settings.txt

You can redirect the output of the netsh interface dump to a text file and
execute it again with the netsh exec command. Wrap this up in a Python
script that dynamically generates the script file and let it execute it. If
you're using the netsh command, there's no need to reboot the system for the
settings to become active. Just be aware that some settings are not saved
(like DNS suffixes and so on). You can find a lot more information in the
Windows 2000 help files or on

PS: ever noticed that this functionality is standard on Macintoshes? Don't
know about Unix though...

Kind regards,


Pieter Claerhout - Application Support
CreoScitex Europe -

-----Original Message-----
From: David LeBlanc [mailto:whisper at oz.nospamnet]
Sent: Friday, May 11, 2001 1:17 AM
To: python-list at
Subject: Re: TCP/IP configuration w/ python on Win2k?

In article <7ubsp1w1oh.fsf at>, 
clee at says...
> I'm interested in using python to quickly change the IP address and
> gateway of a Windows 2000 laptop. (I'm moving around a lot between ports
> with static addresses.)  I've looked through the win32all documentation,
> but with my ignorance of windows system administration I may be missing
> obvious.
> Thanks in advance,
> -chris
grep the registery luke - it's in there somewhere - but you _might_ have 
to do a reboot after changing .... oops, Win2k is supposedly immune to 
reboots after changing network configurations.

Dave LeBlanc

More information about the Python-list mailing list