-->

C# Samples for Windows Parental Controls API

2019-04-10 08:41发布

问题:

Can anyone point me to some C# samples for the Windows Parental Controls API. I want to add some functionality that will allow a user to set the duration their child can be logged on in a day. I want to do this as a F/OSS app so that others can benefit from this too.

Cheers.

回答1:

An application like that already exists: LimitLogin.

Also you could use Limit User Logon Time (would be trivial in C#).

Parental Controls WMI Provider API + ManagementClass Class

Edit: To logout a user: ExitWindowsEx or commands (shutdown, PsShutdown, ...).



回答2:

It seems like there is no way to achieve this using the MS Windows SDK provided API and no c# samples to use as a reference. I tried this for Windows 7 and the only way to make this work is to set the blocked hours the first time someone logs in to the machine each day.