on 07-18-2014 7:44 PM
Hello,
I am having some problems with a script in my Single File Installer package im creating with the Installation Server Admin
Background:
I want to eliminate the users from having to pick the Kerberos token when we roll out SSO. To do this I need the following key in place for each user.
HKEY_CURRENT_USER\Software\SAP\SecureLogin\TokenType = Kerberos
I already confirmed that I can get this key injected by the Windows system when a user (new user or existing user) on the machine by putting in the following keys under HKLM. This is really cool trick if you didn't know already, I have not seen it used here at SCN before, but I ot it from previous experience.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\slctoken\
String: Version"
Value: "1"
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\slctoken
String: StubPath
Value: "reg add "HKEY_CURRENT_USER\Software\SAP\SecureLogin" /v "TokenType" /d "kerberos" /t REG_SZ /F"
Problem:
I can create registry values with this line I also use:
NwEngine.Shell.SetRegValue "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\SAPLOGON_INI_FILE", "REG_EXPAND_SZ", "%userprofile%\AppData\Roaming\SAP\Common\saplogon.ini"
But when I try to create new values in HKEY_CURRENT_USER\Software\SAP\SecureLogin it doesn't work. I think it is because the SecureLogin key does not yet exist. (this can be names anything, I made it up)
Question: (in short)
How can I make a registry subkey with a script inside the Single File Installer? I could also put a bat or vbs in the CustomerFiles folder and run it, but I don't know how.
My users have admin rights, and ultimately this will be pushed with LANDesk as System. So rights is not an issue.
Hi Scott,
I'm not positive, but I thought that NwEngine.SetRegValue would create a key if it didn't exist. I think perhaps part of the problem might be that you are spelling out HKEY_CURRENT_USER instead of abbreviating it HKCU like you do HKLM? I set some HKCU values in my package event scripts and it works fine, but I am abbreviating to HKCU.
The second issue I can see that might come up is with pushing the software out as 'System'. If you do this, then the installer won't be running as the user, which means it won't be able to write to the user's HKCU hive. Does this key have to be in HKCU? Can it be PC-wide in HKLM instead?
The third issue may also have to do with using Single File Installers with LANDesk. I've never used LANDesk, but if it works anything like Microsoft's SCCM (or SMS), then the Single File Installer is the wrong option. For one thing, I've never been able to get the Single File Installer to actually check the box to install the package by default; it presents the package to the end user, who must then manually check the box and click Next, after which the rest of the installation is indeed automated. Instead, you probably want to have your package and scripts well-defined, then create a Package Definition File instead of a Single File Installer. The purpose of the PDF (not to be confused with an Adobe PDF) is to provide instructions to the central installation service about installing from the SAPGUI Installation Server using that package. No Single File Installer is required nor desired. This is how it works with SMS/SCCM, but perhaps LANDesk is different.
Best regards,
Matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yea I confirmed NwEngine.SetRegValue is NOT writing the subkey, it just doesn't run if the subkey isn't in place. Windows command "reg add" will write the subkey for a value if its no there.
Also, im not writing to HKCU, im writing to a special place in HKLM. The key im writing will make the keys in HKCU during logon of the user. So I can run this as system, or local admin.
I allready have a LANDesk SAP installer, useing a VBScript that runs the sap installer, along with out OpenText installer
Here is my VB that is used with LANDesk or SCCM.
'*********************************************************************************
' Install SAP
'*********************************************************************************
Function Install_SAP()
If OSArch = "x64" Then
If objFSO.FileExists(strProgramFiles64 + "\SAP\FrontEnd\SAPgui\saplogon.exe") Then
Else
strCurrentDir = Left(WScript.ScriptFullName, (InstrRev(WScript.ScriptFullName, "\") -1))
application = chr(34) + strCurrentDir + "\sapgui\sapgui730.exe" + chr(34) + " /NoDlg /Package=" + chr(34) + "Esri" + chr(34)
objShell.Run(application),1,true
End If
Else
If objFSO.FileExists(strProgramFiles + "\SAP\FrontEnd\SAPgui\saplogon.exe") Then
Else
strCurrentDir = Left(WScript.ScriptFullName, (InstrRev(WScript.ScriptFullName, "\") -1))
application = chr(34) + strCurrentDir + "\sapgui\sapgui730.exe" + chr(34) + " /NoDlg /Package=" + chr(34) + "Esri" + chr(34)
objShell.Run(application),1,true
End If
End If
End Function
I do wish that SAP would provide documentation on the functions in their 'NWEngine' shell, but lacking that, you can still define your own inside the package event script. For instance, something like:
Set oShell = CreateObject("WScript.Shell")
strRegPath = "HKLM\<whatever>"
strRegValue = "<your value>"
oShell.RegWrite strRegPath, strRegValue, "REG_EXPAND_SZ"
Modify as appropriate, of course. This should work inside an event script. Alternatively, you can use the WMI StdRegProv method:
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strRegPath = "registry path to key"
Return = oReg.CreateKey(HKEY_LOCAL_MACHINE, strRegPath)
--m
They didn't work I have a simple VM that does what I Need, is there a way to make this work in "on Install End"
HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set ObjRegistry = _
GetObject("winmgmts:{impersonationLevel = impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
strPath = "SOFTWARE\Microsoft\Active Setup\Installed Components\slctoken"
Return = objRegistry.CreateKey(HKEY_LOCAL_MACHINE, strPath)
If Return <> 0 Then
WScript.Echo "The operation failed." & Err.Number
WScript.Quit
Else
wScript.Echo "New registry key created" & VBCRLF _
& "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\slctoken"
End If
I would have expected that to work. In your script, you might consider changing your WScript.Echo statements to NWEngine.Context.Log.Write statements instead, so that the messages will be written to the sapsetup log. The WScript.Quit statement is probably unnecessary.
Have you tested whether your scripts work when running directly from the Installation Server, and not in the self-extractor?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.