Jump to content
Sign in to follow this  
jguinch

Change IPAddress without WMI

Recommended Posts

jguinch

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.

Share this post


Link to post
Share on other sites
JLogan3o13

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? ;)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
jguinch

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...

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • richietheprogrammer
      By richietheprogrammer
      Hey all, back with some more AD questions. Is it possible to return machine info (computer name) given a username? Id like to know what computer a specific user is logged in to (and maybe a little history of when they last logged in to which computer), and Im thinking my best odds are using the AD UDF? Thanks for any help!!
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.