How to enable or disable network connection settings

When I open the network connection properties in the windows, I see this dialog box: Connection_Properties http://www.freeimagehosting.net/uploads/ca7a4d82ea.png

In this dialog box in the check-listbox, I can enable or disable options such as File or Printer Sharing, Client for Microsoft Networks, or network filter drivers.

My question is: how to enable or disable these options programmatically? I did not find anything like this in the WMI documentation, and I could not find another Win32 API for this. I would prefer the C interface Win32 API or WMI, but a solution using any programming language is welcome. The question is a linguistic agnostic.

+4
source share
2 answers

I think INetCfg is what you are looking for:

http://msdn.microsoft.com/en-us/library/ff547694%28VS.85%29.aspx

Edit: Here is a link to a discussion where someone uses INetCfg to disable file and printer sharing.

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/b0407073-07bc-462b-9de9-7295be5fa183

+3
source

For anyone new to programming and still learning, or for people who don't have time to use the INetCfg code, ho1 is mentioned, I found a tool called nvspbind that does just that. It can be used to set the correct binding and enable / disable certain bindings on any network adapter.

+1
source

Source: https://habr.com/ru/post/1307631/


All Articles