开发者

How do I disable the network connection from .NET without needing admin privileges?

开发者 https://www.devze.com 2022-12-26 02:12 出处:网络
I may be SOL on this but I thought I would give throw it out for possible solutions. I am writing a computer access control service to help me control my kids\' computer use. Plan on open sourcing it

I may be SOL on this but I thought I would give throw it out for possible solutions.

I am writing a computer access control service to help me control my kids' computer use. Plan on open sourcing it when I have it working. It is written in VB.Net and needs to work on XP through 7.

I am running into all sorts of security and desktop access issues on Windows 7. The service needs to run as admin to execute the NetSh command to disable the network. But I cannot interact with the desktop from the service so I IPC to a UI to handle other stuff, but I still cannot detect from the service if the desktop is locked. Argghh!

I could get it all working from a hidden windows form app if I could just lick the one piece that needs admin permissions: disabling the network.

It does no good if a kid logs on and denies the popup asking if the program should run as administrator and he says no. Also windows 7 will not start a program set to run as admin using

HKEY_开发者_如何转开发LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Anyone know how to get this working? Or have an outside the box solution?


I wish I could provide some references, but I'm failing at my google-fu right now... but I'm pretty sure UAC doesn't apply to services. If you implement your program as a windows service application instead of a (hidden) windows forms application, and set it up to run for your kids' user accounts and not your own, that should work.

UPDATE

Found this on google, haven't played with it at all. Looks sound though... basically, CreateProcessAsUser to run the forms app from your service app that's running as administrator.

0

精彩评论

暂无评论...
验证码 换一张
取 消