I found the solution. Reading from the secedit export is perfect: https://gist.github.com/jkingry/421802
Edit secpol.msc programmatically?
-
04-04-2022 - |
Question
Is there a way to edit the settings from secpol.msc programmatically?
I am looking for something similar to this:
ManagementScope scope = new ManagementScope("root\\rsop\\user\\" + user.User.Value.Replace('-', '_'));
ObjectQuery query = new ObjectQuery("Select * from RSOP_PolicySetting");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
Is root\secpol\... an option?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow