Command line edit of parental controls

1

I'm new to windows administration and pardon me if I write something stupid :)

I've been given a task to enable installation of specific apps on win7 user account with parental controls restriction. User does not want to enter in GUI interface of parental controls - since there are a lot of exe file to enable and process is quite slow.

So I created a simple .bat file which modifies registry and allows .exe execution for provided user. Registry changes work properly - exe is added on allowed list (seen in parental controls settings GUI).

However registry change does not seem to be sufficient. Change is not applied until something is changed over GUI (for example enabling/disabling some other app). This makes me wonder do I miss any registry key changes or is there some kind of cache layer for parental controls app? (I tried changing registry value for "last settings change" but it didn't helped)

Here is the example of batch file for one app:

@echo off

set user=MyWinUser
set installkeyname={41e30d46-71eb-4e79-b5ed-28adb26ca9ff}
set installpath=C:\MyPath\app.exe

for /f "delims= " %%s in ('"wmic useraccount where name='%user%' get sid"') do (

    if not "%%s"=="SID" ( 
        set uid=%%s
        goto :sid_end
    )
)

:sid_end

: Add install path
C:\Windows\System32\reg.exe add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Parental Controls\Users\%uid%\App Restrictions\%installkeyname%" /v "Path" /t REG_SZ /d "%installpath%"
C:\Windows\System32\reg.exe add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Parental Controls\Users\%uid%\App Restrictions\%installkeyname%" /v "Allowed" /t REG_DWORD /d 1

: Set "SAFER_LEVELID_FULLYTRUSTED" for install path
C:\Windows\System32\reg.exe add "HKEY_USERS\%uid%\Software\Policies\Microsoft\Windows\Safer\CodeIdentifiers\262144\Paths\%installkeyname%" /v "Description" /t REG_SZ /d ""
C:\Windows\System32\reg.exe add "HKEY_USERS\%uid%\Software\Policies\Microsoft\Windows\Safer\CodeIdentifiers\262144\Paths\%installkeyname%" /v "ItemData" /t REG_SZ /d "%installpath%"
C:\Windows\System32\reg.exe add "HKEY_USERS\%uid%\Software\Policies\Microsoft\Windows\Safer\CodeIdentifiers\262144\Paths\%installkeyname%" /v "SaferFlags" /t REG_DWORD /d 0
C:\Windows\System32\reg.exe add "HKEY_USERS\%uid%\Software\Policies\Microsoft\Windows\Safer\CodeIdentifiers\262144\Paths\%installkeyname%" /v "LastModified" /t REG_QWORD /d 1435215704000036

pause

Bernard

Posted 2015-06-25T10:04:40.197

Reputation: 111

No answers