Jump to content

Change IPAddress without WMI


jguinch
 Share

Recommended Posts

Hello everybody.

Few months ago, I've written a >network UDF.

The functions witch configure the network use WMI to do that (ex : EnableStatic method for changing the IP adress)

But now, I'm looking for a way to avoid using WMI, because somethimes, on some computers, WMI may not work.

I do not want to use an external tool or command (like netsh).

I've search for a solution on MSDN with the WinAPI fonctions (IP Helper). The functions that would allow me to add or delete an IP adress are AddIPAddress and DeleteIPAddress. But as the MSDN says :

 - The IPv4 address added by the AddIPAddress function is not persistent.

 - To create an IPv4 address that persists, the EnableStatic method of the Win32_NetworkAdapterConfiguration Class

Unfortunately, I don't know if there is another solution than using wmi... :

My idea is to change the IP adress in the registry and then use AddIPAddress to apply the modification without restarting Windows.

Firstly : do you think my idea is realiable ?

Secondly : how can I use the AddIPAddress function ? (I'm not good at all with using WinAPI)

Thanks for your help and suggestions.

Link to comment
Share on other sites

  • Moderators

You do a lot to limit how you want things done; you don't want to use WMI, you don't want to use an external app, you don't want to use netsh. What did you expect the response would be? ;)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks JLogan3o13, you're right... :>

In fact, I was hoping it would be possible to change the IP address by editing the registry and calling AddIPAddress function of the Windows API (in order to apply the setting).
I wanted some opinions on whether it was possible or not. I really do not know the API (but here, many people seem to have mastered)

I also thought that someone might have tried to do that.

But it's not a blocking thing, so...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...