I’m attempting to write some C# code to programmatically read/write the Family Safety controls in Windows 8, in particular the Web and Application Filter lists.
WMI can expose the values with a command such as:
PS C:\Windows\system32> Get-WmiObject -Class WpcURLOverride -Namespace root/CIMV2/Applications/WindowsParentalControls
__GENUS : 2
__CLASS : WpcURLOverride
__SUPERCLASS :
__DYNASTY : WpcURLOverride
__RELPATH : WpcURLOverride.SID="S-1-5-21-4241459202-2635765079-3956675256-1002",URL="http://block.com"
__PROPERTY_COUNT : 3
__DERIVATION : {}
__SERVER : TEST-BOX
__NAMESPACE : root\CIMV2\Applications\WindowsParentalControls
__PATH : \\TEST-BOX\root\CIMV2\Applications\WindowsParentalControls:WpcURLOverride.SID="S-1-5-21-4241459202-2
635765079-3956675256-1002",URL="http://block.com"
Allowed : 2
SID : S-1-5-21-4241459202-2635765079-3956675256-1002
URL : http://block.com
PSComputerName : TEST-BOX
__GENUS : 2
__CLASS : WpcURLOverride
__SUPERCLASS :
__DYNASTY : WpcURLOverride
__RELPATH : WpcURLOverride.SID="S-1-5-21-4241459202-2635765079-3956675256-1002",URL="http://allow.com"
__PROPERTY_COUNT : 3
__DERIVATION : {}
__SERVER : TEST-BOX
__NAMESPACE : root\CIMV2\Applications\WindowsParentalControls
__PATH : \\TEST-BOX\root\CIMV2\Applications\WindowsParentalControls:WpcURLOverride.SID="S-1-5-21-4241459202-2
635765079-3956675256-1002",URL="http://allow.com"
Allowed : 1
SID : S-1-5-21-4241459202-2635765079-3956675256-1002
URL : http://allow.com
PSComputerName : TEST-BOX
This question mentions duplicating an existing object, but I haven’t found a way to do so with generic or these specific WMI objects.
How do I insert or remove entries?
Thanks for your input.
Posting a viable, if not ideal, answer for completeness. These snippets apply rather specificly to my use case, but hopefully they can help someone