c# - Disabling network adapter without admin rights prompt -


i need enable/disable network adapters (kinda flight mode) on windows 8 tablet when user clicks on button.

this can done following cmdlet in powershell: "disable-netadapter * –confirm:$false" , it's counterpart enable-netadapter. expect them do, have 2 problems:

  1. i don't want run powershell wpf application. since it's built on .net framework, there way same without calling cmdlet?

  2. it requires elevated rights (like starting app right click +"run administrator"). can elevated permissions code, user access control popup asking approval. there way start application elevated rights without getting popup?

the win32_networkadapter class contains enable/disable methods http://msdn.microsoft.com/en-us/library/aa394216

here's code example programmatically enable / disable connection

you need run in admin or system context if operation requires them, ideally system uac not in way, run service !


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -