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:
i don't want run powershell wpf application. since it's built on .net framework, there way same without calling cmdlet?
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
Post a Comment