2017-02-12 2 views
0

У меня есть этот код, чтобы включить родительский контроль в Windows:Как добавить пределы программы в родительском контроле с помощью WMI

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(); 
} 

этим, включен родительский контроль, но как я могу установить пределы программы для определения разрешенных программ?

ответ

Смежные вопросы