Kaseya Community

File Path in Set Registry Value Step

This question is answered

I have been testing this in several different ways, but I cannot seem to get a Set Registry Value step to produce the results I am looking for. I have a client that has a home-grown application that in Windows 7 has to run in Windows XP SP3 compatibility mode. I have found that in order for the particular EXE files to run consistently in compatibility mode, you can add a registry key to the HKLM that will automatically make these settings apply to all users of the computer. The key location is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers then you must create a REG_SZ with the name of the key being the file name you want to be in compatibility mode and the value should be WINXPSP3. The issue I am running into is when the procedure executes, it reads the entire path instead of creating the proper key. My example is: (the file name is in bold. This needs to be the name)

 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\C:\Users\jchamness\downloads\firefox setup 7.0.exe

This will create the sub-level keys under Layers as C: -> Users -> jchamness -> downloads -> NAME: firefox setup 7.0.exe VALUE: WINXPSP3

 

I have tested using quotation marks around the file name, double slashes in the file name, double slashes between the key and the file name, & all combinations in between. I even took the file name and attempted to use it in the Value box with an equals sign for the actual value. I have attached below what a registry export shows when this is implemented correctly by manually setting the Compatibility Mode on the file itself. Any help in trying to figure out the syntax of the Set Registry Value step would be greatly appreciated. Thanks.

 

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]

"C:\\Users\\jchamness\\Downloads\\Firefox Setup 7.0.exe"="WINXPSP3"

 

Verified Answer
  • The syntax can be trouble some some times I found that some times it is easier just to upload the .reg file and execute it using regedit.exe /S command but if that does not work for you try and configure the Compatibility Mode for the application you want on a test machine and use the REG QUERY Dos Command and run a query on the "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\" key.

    This should give the correct syntax to use for your Kaseya script just remember to revert it back from HKLM to HKEY_LOCAL_MACHINE Smile

    If you are still having troubles with adding the key via the Agent Procure step use command REG ADD with an Execute Command step to add the key instead.

All Replies
  • The syntax can be trouble some some times I found that some times it is easier just to upload the .reg file and execute it using regedit.exe /S command but if that does not work for you try and configure the Compatibility Mode for the application you want on a test machine and use the REG QUERY Dos Command and run a query on the "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\" key.

    This should give the correct syntax to use for your Kaseya script just remember to revert it back from HKLM to HKEY_LOCAL_MACHINE Smile

    If you are still having troubles with adding the key via the Agent Procure step use command REG ADD with an Execute Command step to add the key instead.

  • I wrote a .reg file and executed it to achieve this as my workaround. The reg query just shows the entire file path like I was trying to use before. Either a .reg file or reg add works, so I am happy. Thanks for your help.