【问题标题】:How add program limits in parental control using wmi如何使用 wmi 在家长控制中添加程序限制
【发布时间】:2017-02-12 05:53:28
【问题描述】:

我有这段代码可以在 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();
}

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

【问题讨论】:

    标签: c# parental-control


    【解决方案1】:

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

    SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
    

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

    【讨论】:

      猜你喜欢
      • 2011-08-08
      • 2020-03-11
      • 2016-05-21
      • 1970-01-01
      • 1970-01-01
      • 2015-07-23
      • 1970-01-01
      • 1970-01-01
      • 2018-01-02
      相关资源
      最近更新 更多