473,385 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Change system IP address and DNS setting automatically

Dear friends,
can any one guide me how to write a code (or show me a snipet of code) in VB6 which can change the IP address and DNS of the computer to my desired addresses. I have 2 networks one in office and one at home both require me to manually change my IP and DNS every time in my laptop.
Nov 4 '08 #1
2 7127
jg007
283 100+
connecting to WMI would probably be easiest and I believe that you can set IP address easy enough via that the only issue would be locating the correct network adaptor as it would usually show approx 10 items including the infared port

the WMI query would probably be ' SELECT * FROM Win32_NetworkAdapterConfiguration ' and then run through that till you find the correct adaptor

sorry, I don't have any code available but if you cannot find anything I will work some out.

the items available through WMI on the network card -


instance of Win32_NetworkAdapterConfiguration
{
Caption = "[00000009] Ralink RT2500 Wireless LAN Card";
DatabasePath = "%SystemRoot%\\System32\\drivers\\etc";
DefaultIPGateway = {"<your default gateway>"};
Description = "Ralink RT2500 Wireless LAN Card - Virtual Machine Network Services Driver";
DHCPEnabled = TRUE;
DHCPLeaseExpires = "20081109150849.000000+000";
DHCPLeaseObtained = "20081104150849.000000+000";
DHCPServer = "<your DHCP server here>";
DNSDomain = "<Domain Name>";
DNSEnabledForWINSResolution = FALSE;
DNSHostName = "<your hostname here>";
DNSServerSearchOrder = {"<your DNS addresses here>"};
DomainDNSRegistrationEnabled = FALSE;
FullDNSRegistrationEnabled = TRUE;
GatewayCostMetric = {25};
Index = 9;
IPAddress = {"<your IP address here>"};
IPConnectionMetric = 25;
IPEnabled = TRUE;
IPFilterSecurityEnabled = FALSE;
IPSecPermitIPProtocols = {"0"};
IPSecPermitTCPPorts = {"0"};
IPSecPermitUDPPorts = {"0"};
IPSubnet = {"255.0.0.0"};
IPXEnabled = FALSE;
MACAddress = "00:0E:2E:66:37:02";
ServiceName = "RT2500";
SettingID = "{E598F9ED-4410-4D57-AB66-8EF153AA6727}";
TcpipNetbiosOptions = 0;
WINSEnableLMHostsLookup = TRUE;
WINSScopeID = "";
};
Nov 4 '08 #2
jg007
283 100+
just found this -

http://www.windowsnetworking.com/art...pts-Part4.html

this is VBscript but you should be able to convert it to vb pretty easily
Nov 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Xiaopeng Qu | last post by:
Hi, I installed DB2 8.1 Express with multiple language: English and Chinese, but the interface like: Control Center, CLP, etc alway display Chinese, is there a way to change the display language...
2
by: david | last post by:
When you right click on a file in windows, there is a property of type of file, which seems to associate this file with an application for it. For example, when you double click on a .doc file, the...
4
by: Shapper | last post by:
Hello, I have this image in my HTML code: <img src="images/en-US/myImage.jpg" /> I want to change the URL using the value of a Session variable. <img src="images/ Session("culture") Value...
4
by: Andre Nogueira | last post by:
hi there. I am creating a tabcontrol where the drawing of the tabs is controlled by me. However, i cannot find a way to change the lenght of the tab. For instance, "String" needs a smaller tab...
2
by: scorpion53061 | last post by:
hi all, I thought I would give this back and see if anyone could improve on it. I was working with the remote registry class. This code opens the ScreenSaverIsSecure registry setting and changes...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
1
by: jcprince | last post by:
Hi Not sure I can do what I'm trying to do without using a 3rd party component like Dart. I need to build a windows service to create a socket connection on an IBM mainframe using an IP and port...
1
by: Darwin | last post by:
Setting a server to listen on 8080 for incoming connections. Written in VS2005 on a Multi-homed machine. I get the warning: Warning 1 'System.Net.Sockets.TcpListener.TcpListener(int)' is obsolete:...
30
by: Yorian | last post by:
Hey, Although I've been using classes and object for quite a while now I've never actually programmed proper OO code yet. It ofcourse depends on what you call proper OO code. I have been...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.