How to disconnect a .NET network connection without requiring administrator privileges?

I can be SOL on this, but I thought I'd let it throw away for possible solutions.

I am writing a computer access control service to help me control the use of my baby computer. Plan open source when I work. It is written in VB.Net and should work with XP up to 7.

Windows 7 launches all kinds of security and desktop access issues. The service must be started as an administrator to execute a NetSh command to shut down the network. But I can’t interact with the desktop from the service, so IPC for the user interface handle other things, but I still can’t detect from the service if the desktop is locked. Argghh!

I could make it all work from a hidden Windows application, if I could just lick one part that requires administrator privileges: disconnect the network.

It is not good if the child enters the system and denies a pop-up window asking if the program should work as an administrator, and he says no. In addition, Windows 7 does not launch a set of programs that run as admin using HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Does anyone know how to do this? Or do you have an external solution?

+4
source share
1 answer

I would like to provide some links, but now I can not use my google-fu ... but I am sure that UAC is not related to services. If you are implementing your program as an application for Windows applications, and not for an application of (hidden) forms of Windows, and configure it to run your children's accounts, not your own, which should work.

UPDATE

Found it on google, did not play with it at all. It looks, though ... basically, CreateProcessAsUser to run the forms application from your service application, which works as an administrator.

+2
source

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


All Articles