cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with script creation for EndInstall - SetReg

Former Member
0 Kudos

I am having trouble setting a new Registry value create a System Env Var

I need to set SAPLOGON_INI_FILE System env var for each client machine. However although I can the command

NWEngine.Shell.SetRegValue to adjust the value of an existing registry key

When I try SetRegKey to create a new key this is an invalid command.

Therefore How can I create a new registry key for

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]"SAPLOGON_INI_FILE"="C:
Program Files
SAP
FrontEnd
SAPgui
SAPLOGON.INI"

My code is as follows

' Add System Environment Variable for SAPLOGIN.INI'

If NwEngine.Shell.RegKeyExist("HKLM\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\SAPLOGON_INI_FILE") Then

NwEngine.Shell.DeleteRegKey ("HKLM\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\SAPLOGON_INI_FILE")

NwEngine.Shell.SetRegKey "HKLM\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\SAPLOGON_INI_FILE","REG_SZ","C:\Program Files\SAP\FrontEnd\sapgui\saplogon.ini"

End If

Is there any other way from this scripting to set this ENV var...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I was just doing the same thing. Although I realize this post is getting old.

I did it by using:

strRegEnv = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\SAPLOGON_INI_FILE"

NwEngine.Shell.SetRegValue strRegEnv, "REG_SZ", "(FILE LOCATION)"

I placed that at the "On end Install" and "On end Update" Level.

if the reg value is not already present, it will be created.

If the reg value does exist, it is replaced.

Hope that helps.

0 Kudos

I added the SAPLOGON_INI_FILE reg entry to in the "on begin install" scripting event to get it to work without a reboot and I used a REG_EXPAND_SZ not a REG_SZ.

Matt

0 Kudos

I typed the above too soon as i'm still struggling to update variable without a reboot.

Matt

Answers (1)

Answers (1)

Former Member
0 Kudos

I need to check whether system is  32 bit or 64 bit depending on which i Have to change the registry value as the key lies in differnt paths.

how can we check this?

Actually I cannot get the command in NWEngine.shell.

Will the following work?//

if %PROCESSOR_ARCHITECTURE%==x86 (
  Then ----

) else (
  ------

)

jesus_e_osorio
Discoverer
0 Kudos

When I try to verify if  is a x64 OS i use this verification:

strDstX64 = NwEngine.Variables.ResolveString("%WINDIR%\SYSWOW64\cmd.exe")

If NwEngine.Shell.FileExist( strDstX64 ) then

         .....

End if

This file it's must exist on any windows 64 bit (is the cmd.exe with 32 bit compatibility)