Discussion Locked

VBScript - Static to DHCP & Back again

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I've found a script that will help me move a computer from DHCP to static and back. I have a user who travels to multiple locations, all DHCP enabled except 1. The only problem is, this script does not clear the gateway entry when it switches back to dhcp. So the static gateway stays put. Can anyone provide me with code to clear the gateway so that the address provided by DHCP will be used? I've tried several variations, but I'm not very good at scripting. I've already looked at http://msdn.microsoft.com/library/en-us/wmisdk/wmi/setdnsserversearchorder_method_in_class_win32_networkadapterconfiguration.asp

Thanks.

2 replies

by joshua1

Can you show how to incorporate the Command Line commands into vbscript? Or how to call the batch file from within the VBS file?

That's already what I'm doing as a workaround: they run the vbs for one, and run a batch for another. If I can get it all into a vbs, then the script can tell which way to go - to DHCP or to Static - based on what the current settings are. Right now, the users have to know if they need to have static IP configurations or if they need to be on DHCP. Simple stuff in IT...not so simple for tech-nots.

This discussion is closed to new replies.