0

我有这段代码可以在 Windows 中启用家长控制:

System.Security.Principal.NTAccount myNTAccount = new System.Security.Principal.NTAccount("username");
System.Security.Principal.SecurityIdentifier mySecurityIdentifier = (System.Security.Principal.SecurityIdentifier)myNTAccount.Translate(typeof(System.Security.Principal.SecurityIdentifier));


ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2\\Applications\\WindowsParentalControls", "SELECT * FROM WpcUserSettings where SID='" + mySecurityIdentifier.ToString() + "'");
foreach (ManagementObject queryObj in searcher.Get())
{
    queryObj["AppRestrictions"] = true;
    queryObj["HourlyRestrictions"] = true;
    queryObj["LoggingRequired"] = false;
    //queryObj["LogonHours"] = ;
    //queryObj["OverrideRequests"] = ;
    queryObj["WpcEnabled"] = true;
    queryObj.Put();
}

这样,启用了家长控制,但是我如何设置程序限制来定义允许的程序?

4

1 回答 1

0

我发现它与 RestrictRun 注册表项有关:

SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer

它在这个地址中解释: https ://www.howtogeek.com/howto/8739/restrict-users-to-run-only-specified-programs-in-windows-7/

于 2017-11-28T05:49:51.760 回答