Getting and Setting the network settings.

  • Thread starter Thread starter UJ
  • Start date Start date
U

UJ

I had already asked how to get the network settings on the machine and was
told that I should use the WMI interface. I downloaded programs that will
allow me to look at the stuff but I'm not sure which items are the correct
ones to get.

Can anybody give me a direction on where I look to figure out how to get/set
the IP address, gateway, DNS Server and Proxy Server? When I look in one of
the dump programs there is lots of stuff about network adapters but I can't
figure out which is the one I want.

TIA - Jeff.
 
Jeff,

You can use the Win32_NetworkAdapterConfiguration class. The properties
you want are:

IPAddress
DNSServerSearchOrder
DefaultIPGateway

The proxy is a different story, that you would get from the program
itself that is using the proxy. This program might or might not have a WMI
interface. Or do you mean another type of proxy that is system wide?

Hope this helps.
 
Nicholas,
I guess I'm not sure what I mean. My network engineer wants to be able to
change the proxy server through our interface.

Is that enough information or do I need his input?

TIA - Jeff.

Nicholas Paldino said:
Jeff,

You can use the Win32_NetworkAdapterConfiguration class. The
properties you want are:

IPAddress
DNSServerSearchOrder
DefaultIPGateway

The proxy is a different story, that you would get from the program
itself that is using the proxy. This program might or might not have a
WMI interface. Or do you mean another type of proxy that is system wide?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

UJ said:
I had already asked how to get the network settings on the machine and was
told that I should use the WMI interface. I downloaded programs that will
allow me to look at the stuff but I'm not sure which items are the correct
ones to get.

Can anybody give me a direction on where I look to figure out how to
get/set the IP address, gateway, DNS Server and Proxy Server? When I look
in one of the dump programs there is lots of stuff about network adapters
but I can't figure out which is the one I want.

TIA - Jeff.
 
Nicholas,
All the documentation I've seen talks about using either VBScript or CScript
to use this object. Can it be used in a C# program?

If not - how do I get/set the info?

TIA - Jeff.

UJ said:
Nicholas,
I guess I'm not sure what I mean. My network engineer wants to be able to
change the proxy server through our interface.

Is that enough information or do I need his input?

TIA - Jeff.

Nicholas Paldino said:
Jeff,

You can use the Win32_NetworkAdapterConfiguration class. The
properties you want are:

IPAddress
DNSServerSearchOrder
DefaultIPGateway

The proxy is a different story, that you would get from the program
itself that is using the proxy. This program might or might not have a
WMI interface. Or do you mean another type of proxy that is system wide?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

UJ said:
I had already asked how to get the network settings on the machine and
was told that I should use the WMI interface. I downloaded programs that
will allow me to look at the stuff but I'm not sure which items are the
correct ones to get.

Can anybody give me a direction on where I look to figure out how to
get/set the IP address, gateway, DNS Server and Proxy Server? When I
look in one of the dump programs there is lots of stuff about network
adapters but I can't figure out which is the one I want.

TIA - Jeff.
 
A proxy server can mean anything. Is it a proxy for external
connections? Is it ISA server? Some more information is needed.

For example, you can set the proxy server for http requests in Internet
Explorer, but this is just IE, it's not for the whole system.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

UJ said:
Nicholas,
I guess I'm not sure what I mean. My network engineer wants to be able to
change the proxy server through our interface.

Is that enough information or do I need his input?

TIA - Jeff.

Nicholas Paldino said:
Jeff,

You can use the Win32_NetworkAdapterConfiguration class. The
properties you want are:

IPAddress
DNSServerSearchOrder
DefaultIPGateway

The proxy is a different story, that you would get from the program
itself that is using the proxy. This program might or might not have a
WMI interface. Or do you mean another type of proxy that is system wide?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

UJ said:
I had already asked how to get the network settings on the machine and
was told that I should use the WMI interface. I downloaded programs that
will allow me to look at the stuff but I'm not sure which items are the
correct ones to get.

Can anybody give me a direction on where I look to figure out how to
get/set the IP address, gateway, DNS Server and Proxy Server? When I
look in one of the dump programs there is lots of stuff about network
adapters but I can't figure out which is the one I want.

TIA - Jeff.
 
Jeff,

Yes, you will want to use the classes in the System.Management namespace
in order to access the WMI classes.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

UJ said:
Nicholas,
All the documentation I've seen talks about using either VBScript or
CScript to use this object. Can it be used in a C# program?

If not - how do I get/set the info?

TIA - Jeff.

UJ said:
Nicholas,
I guess I'm not sure what I mean. My network engineer wants to be able to
change the proxy server through our interface.

Is that enough information or do I need his input?

TIA - Jeff.

Nicholas Paldino said:
Jeff,

You can use the Win32_NetworkAdapterConfiguration class. The
properties you want are:

IPAddress
DNSServerSearchOrder
DefaultIPGateway

The proxy is a different story, that you would get from the program
itself that is using the proxy. This program might or might not have a
WMI interface. Or do you mean another type of proxy that is system
wide?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I had already asked how to get the network settings on the machine and
was told that I should use the WMI interface. I downloaded programs that
will allow me to look at the stuff but I'm not sure which items are the
correct ones to get.

Can anybody give me a direction on where I look to figure out how to
get/set the IP address, gateway, DNS Server and Proxy Server? When I
look in one of the dump programs there is lots of stuff about network
adapters but I can't figure out which is the one I want.

TIA - Jeff.
 
Back
Top