Hi all,

I have a simple .bat script that changes a registry value, that works great when running manually:


@Echo Off
cd %systemroot%\system32

Reg.exe add "HKCU\Control Panel\Desktop" /v "LogPixels" /t REG_DWORD /d "96" /f


However, when I push this through Kace, it is showing as complete, but no change actually happens in the registry.

I've tried switching the account to run as.. from "local system" to my own domain admin account, but still not pushing correctly through Kace. I am able to run the script fine by double-clicking it on the machines, or running as my domain admin account.

The script just changes the DPI settings in Windows to 100%, as we have some machines that are joined to the domain, but logged into a local account.. so they are not able to get this setting from GP.

Any ideas?
Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answer Chosen by the Author

2
That's because HKCU changes are made for the account / user who executed this script. In your case it was 'Local system' or domain admin. For the Local System changes were made under HKU\S-1-5-18\ as this is the SYSTEM's HKCU. The same was for the script started by the domain admin account - it has changed HKCU for this domain admin, not for the currently logged on user.
To run your script for the currently logged on user you may consider:
ActiveSetup
RunAsCurrentUser
NTUSER.DAT *

*This is for the professionals who knows what is the execution context :) (personally I do not like this method).
Answered 12/14/2017 by: rad33k
Fourth Degree Green Belt

  • AH!! Thank you very much. That makes perfect sense. Haha. I even called Quest to see if they had an answer and they are still "looking into this".

    I'll try this first thing tomorrow, but I don't see why it wouldn't work.

    I just needed a second pair of eyes to reiterate "CURRENT USER" to me. :)
    • You are welcome ;) Sometimes the "Rubber duck debugging" is very helpful ;-)
Please log in to comment

Answers

Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share