9/14/2025 4:29:10 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss general administration topics for SalesLogix (including LAN & remote topics). View the code of conduct for posting guidelines.
|
|
|
|
Command Line Login
Posted: 02 May 07 2:56 PM
|
fiogf49gjkf0d Here's the situation.
We have two SLX databases that a user can log into. Both databases use NT authentication. (the 2nd database is a recent addition) We were trying to setup a two shortcuts as follows:
c:\Program Files\SalesLogix\SalesLogix.exe /B 1st_DBName and c:\Program Files\SalesLogix\SalesLogix.exe /B 2nd_DBName
with the intent that it would change the data line to the data link specified with th /B parameter. Apparently this is not the case when NT Autentication is turned on. So we tried turning off NT Authentication and tried the following
c:\Program Files\SalesLogix\SalesLogix.exe /B 1st_DBName /U username
And that was not working either. It was still remembering the last logged in data link. The only way we could get it to work with NT Authentication turned off was this way
c:\Program Files\SalesLogix\SalesLogix.exe /B 1st_DBName /N username /P password
Which is not desirable because of the exposed password being a security issue.
Is there anyway to specify what datalink to use from the command line without exposing the password. Ideally we'd like to have NT authentication turned on and just specify which datalink to use from the shortcut.
Thanks! John G. |
|
|
|
Re: Command Line Login
Posted: 02 May 07 3:15 PM
|
fiogf49gjkf0d A problem indeed!
I have 4 database options SOME users can log in to. Unfortunately those users I have setup with 4 different shortcuts. As you mentioned there is the issue with the password exposed in clear text in the "target" parameter of the shortcut.
Furthermore, AD authentication utilizes only the HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1 "Data Source" registry key. So the last database accessed is the database that will call for the AD authentication if AD authentication is turned on for that user in the SLX database.
A way around this is to package an EXE using AutoIt (or your favorite EXE creation tool) call the same shortcut "target" that you have specified with the SLX database instance, user name and password all embedded in the EXE, solving the exposed password in clear text issue. A different EXE for each user would have to be created for each shortcut and that would make administration of this solution a nightmare - especially in the case of password changes - exponentially a nightmare in the case of MANY users.
Anyone else have a better suggestion? I'm all ears, too! |
|
|
|
Re: Command Line Login
Posted: 02 May 07 3:26 PM
|
fiogf49gjkf0d There's the /BYPASSNTLOGIN parameter but because it requires the username/password pair I doubt you'd use it.
I'm guessing here but I think the problem is due to the fact that the last logged in database is cached in the registry. NT Auth most likely queries this value and attempts to login. If it fails that connection, THEN it brings up the prompt.
What I would do is turn off NT Auth and record the registry entries for both databases to be thorough(HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1). Most likely the only changed values will be Alias and Initial Catalog which should both point to the database name. Then instead of running a shortcut create a .cmd or .bat file that changes the registry. If the registry is changed it most likely means you won't need command-line parameters. |
|
|
|
Re: Command Line Login
Posted: 02 May 07 3:47 PM
|
fiogf49gjkf0d What this tells me is it's FAR easier to create an AD solution for multiple databases than it would be for standard logins using the commandline. While hacking the registry could work for normal logins (changing DBUsername, Alias, and InitialCatalog at least), you'd still run into problems with the encrypted DBPassword value.
What you could do is create a login front end. It could query your server for known databases and build a dropdown that your user selects. Once a value is selected, it changes the registry then creates a SalesLogix.exe process which uses NT auth to finish the connection. If the user doesn't have access or some other error occurs then the standard login would prompt, performing exactly as it does now. Rather than a front end it could also just be a NT auth configurator, allowing end-users easy access to changing the registry to somewhat known good values. |
|
|
|
Re: Command Line Login
Posted: 03 May 07 6:02 AM
|
fiogf49gjkf0d These are all feasible ideas. We'd like to keep the NT Authentication turned on and not have the user 'think' about anything once clicking the shortcut. The idea is the shortcut is named the database they are logging into.
I think a .CMD/.BAT file will address this best. Basically, the first thing it'll do is modify the registry key
HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1
and change the catalog. Hmm... just looking at the differences between registry keys for different Connections... There is quite a bit more to change = Alias, Data Source, DBPassword (is this needed?) and Initial Catalog. I think exporting each connection hive, modifying it to point to Connection1 and then import them via a .REG file would work. Then you have all the info.
So you would end up with two .REG files. Both would be for hive Connection1 but the keys would point to the appropriate database. The shortcut would point to the .CMD/.BAT which would bedatabase1.reg c:\Program Files\SalesLogix\SalesLogix.exe and the other shortcut would just change the database1.reg to database2.reg.
Now my only question is this... if the .CMD/.BAT calls the .REG file... won't a Windows dialog appear that asks the user to confirm they want to change the registry, blah, blah, blah?
Thanks, John G. |
|
|
|
Re: Command Line Login
Posted: 03 May 07 6:02 AM
|
fiogf49gjkf0d These are all feasible ideas. We'd like to keep the NT Authentication turned on and not have the user 'think' about anything once clicking the shortcut. The idea is the shortcut is named the database they are logging into.
I think a .CMD/.BAT file will address this best. Basically, the first thing it'll do is modify the registry key
HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1
and change the catalog. Hmm... just looking at the differences between registry keys for different Connections... There is quite a bit more to change = Alias, Data Source, DBPassword (is this needed?) and Initial Catalog. I think exporting each connection hive, modifying it to point to Connection1 and then import them via a .REG file would work. Then you have all the info.
So you would end up with two .REG files. Both would be for hive Connection1 but the keys would point to the appropriate database. The shortcut would point to the .CMD/.BAT which would bedatabase1.reg c:\Program Files\SalesLogix\SalesLogix.exe and the other shortcut would just change the database1.reg to database2.reg.
Now my only question is this... if the .CMD/.BAT calls the .REG file... won't a Windows dialog appear that asks the user to confirm they want to change the registry, blah, blah, blah?
Thanks, John G. |
|
|
|
Re: Command Line Login
Posted: 03 May 07 8:33 AM
|
fiogf49gjkf0d I setup this configuration up for my rdp system all the time. When needed, I have a ui that pops, user picks the db from a combobox and the registry is updated. Then saleslogix is launched.
I lost the SLX Provider Server at one clients and it took less than 10 minutes to setup a new provider alias on a testserver, update the registry file and issue a message to logout and backin. It is a very flexible setup.
If your good add a outlook automatic profile builder on too. It is a beautiful thing when bringing new servers on line! Likewise, set the entire office up as NT Auth. and change the user default pwd to a TechService key. Now you can login using the slx pwd as anybody without needing to know a password and they can't.
regedit uses a /s switch to be silent
a vbs file option is: Dim WshShell, oExec, sCmd sCmd = "cmd /c regedit /s ""\\server\share\file.reg"" " Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec(sCmd)
|
|
|
|
Re: Command Line Login
Posted: 03 May 07 10:17 AM
|
fiogf49gjkf0d Originally posted by John Gundrum
Now my only question is this... if the .CMD/.BAT calls the .REG file... won't a Windows dialog appear that asks the user to confirm they want to change the registry, blah, blah, blah?
Thanks, John G. |
|
John,
Yes, a .cmd/.bat calling a .reg would prompt the user to confirm changes to the registry. However, if you used a packaged .exe the user would not be prompted.
Without the proper encrypted user "DBPassword" variable scripted with these methods to the registry AD authentication will fail. Otherwise, the user would need to open SLX, click the ellipses to open the DataLink Manager, select the database, edit/test the connection, OK out to the login screen, cancel out of the login screen, then open SLX - AD authentication would then pass through. |
|
|
|
Re: Command Line Login
Posted: 03 May 07 12:04 PM
|
fiogf49gjkf0d Yes, a .cmd/.bat calling a .reg would prompt the user to confirm changes to the registry. However, if you used a packaged .exe the user would not be prompted. |
|
Sounds reasonable. How would one make a packaged .EXE? Can it be done in .NET or is that like using a 20lb sledge to do the work of a 1lb hammer?
Thanks, John G. |
|
|
|
Re: Command Line Login
Posted: 03 May 07 1:06 PM
|
fiogf49gjkf0d Here is your hammer!
I have tested and verified an AutoIt based EXE that works seamlessly for AD authentication. Download AutoIt from www.autoitscript.com Paste this code, update the variables, and build as an EXE. Put the EXE on a share and let the users run it from there so you can make alterations/additions to the script centrally with less administration.
; ; AutoIt Version: 3.0 ; Language: English ; Platform: WinXP - SMART\Wholesale image ; Author: David Henry (david.henry@ncmc.com) ; Orig. Build 5-3-2007 ; EXE location \\ServerName\ShareName\ScriptName.
; Script function: Dashboard to select SLX database to login.
; Version 1.0 5-3-2007 Initial build/release.
$g_szVersion = "SLXLoginDashboard" If WinExists($g_szVersion) Then Exit AutoItWinSetTitle($g_szVersion)
; ******************************Remove AutoIt Tray Icon****************************** #NoTrayIcon
; ******************************Declare Variables****************************** #include $Version = "Version 1" $Server1 = "ServerName1" $Server1Alias = "AliasName1" $Server2 = "ServerName2" $Server2Alias = "AliasName2"
; ******************************Draw the GUI****************************** GUICreate("SalesLogix Login Dashboard", 475,70) ;BUTTON1 $Server1Button= GUICtrlCreateButton("Login to SLX on " & $Server1, 15, 15, 200, 40) ;BUTTON2 $Server2Button= GUICtrlCreateButton("Login to SLX on " & $Server2, 260, 15, 200, 40)
; ******************************Paint the background****************************** GUISetBkColor ( 0xE0DFE3 )
; ******************************GUI Consequences****************************** GuiSetState (1)
While 1 $msg = GUIGetMsg() Select Case $msg = $Server1Button RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Alias", "REG_SZ", $Server1Alias ) RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Data Source", "REG_SZ", $Server1) RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "DBUser", "REG_SZ", "" ) RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Extended Properties", "REG_SZ", "PORT=1706;LOG=OFF" ) ; LOG=ON would be good for a REMOTE database that requires TEF files. RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Initial Catalog", "REG_SZ", $Server1Alias ) RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Provider", "REG_SZ", "SLXOLEDB.1" ) Run ("C:\Program Files\SalesLogix\SalesLogix.exe") Exit Case $msg = $Server2Button RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Alias", "REG_SZ", $Server2Alias ) RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Data Source", "REG_SZ", $Server2) RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "DBUser", "REG_SZ", "" ) RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Extended Properties", "REG_SZ", "PORT=1706;LOG=OFF" ) ; LOG=ON would be good for a REMOTE database that requires TEF files. RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Initial Catalog", "REG_SZ", $Server2Alias ) RegWrite("HKEY_CURRENT_USER\Software\SalesLogix\ADOLogin\Connection1", "Provider", "REG_SZ", "SLXOLEDB.1" ) Run ("C:\Program Files\SalesLogix\SalesLogix.exe") Exit EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend |
|
|
|
Re: Command Line Login
Posted: 03 May 07 1:14 PM
|
fiogf49gjkf0d Originally posted by John Gundrum
Sounds reasonable. How would one make a packaged .EXE? Can it be done in .NET or is that like using a 20lb sledge to do the work of a 1lb hammer?
Thanks, John G. |
|
You could try this. Paste the following in a text file, then rename it "slxconn.vbs":
Dim shell Set shell = CreateObject("WScript.Shell") shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection1\Alias", "My Connection" ' write any other values as needed Set shell = Nothing
Then in your batch file you'd execute the following:
wscript slxconn.vbs
Make sense? |
|
|
|
Re: Command Line Login
Posted: 04 May 07 5:59 AM
|
fiogf49gjkf0d Yep. Makes sense. Going to try just as soon as I can finish a current project.
Thanks again, everyone! John G. |
|
|
|
Re: Command Line Login
Posted: 17 May 07 6:30 AM
|
fiogf49gjkf0d Well, I finally got to working out how to do this. I combined some of the techniques above to come up with a 2lb hammer. What I came up with was something that works well for us and I think will work well for most organizations that use NT Authentication for SalesLogix. This will also work if NT Authentication is not used, but you still have to enter a password. Embedding passwords in VBS (or anywhere) is not recommended.
One of the things I noticed is there could be more than one connection. The HKCU\Software\SalesLogix\ADOLogin registry hive has ten possible connections. I know for myself four are used. Just replacing Connection1 with the required connection information wasn't really going to work. I needed to preserve Connection1 information. What I decided to do instead was write a VBS that swapped the necessary contents of ConnectionX to Connection1.
The first thing the VBS does is search through the connections looking for the Connection alias that matches the passed argument. The values from this connection are then stored in variables. Once that is done, the VBS copies Connection1 values to ConnectionX then updates Connection1 with the values from the variables.
You'll note the userid and password are not copied. The main reason is this information is just a way of storing the user name so it can be displayed in the Saleslogix login if NT Authentication is not used. I don't know the purpose of the encrypted password being stored.
What I did to use the VBS is copied it to a network share then I created a shortcut in the network share for each SalesLogix database. The target, for example, would look like the following
\\networksharepath\SwapSLXConnection.vbs SALESLOGIX
Something that was done in the VBS is executing SalesLogix itself. What I found when calling it via a batch file is the DOS window would hang out in the background waiting for you to close SalesLogix so it can continue executing. To elminate this I created a routine in the VBS that checks if SalesLogix is installed on D: and if not checks C: for the installation. Once it determines the location it does a shell execute to get SalesLogix going and there is no DOS window left hanging out.
Might be easier to see the code So here it is...' Swap passed SalesLogix connection values into HKCU\Software\SalesLogix\ADOLogin\Connection1 ' Connection name is case-sensitive SwapSLXConnection
Sub SwapSLXConnection If Wscript.Arguments.Count = 0 Then MsgBox("No Alias Specified.") Exit Sub End If
Dim shell Set shell = CreateObject("WScript.Shell")
Dim bolCont, strArgument, strAlias, strProvider, strInitialCatalog, strDataSource, strExtendedProperties bolCont = True strArgument = Wscript.Arguments.Item(0)
' Look for the connection alias of the passed argument Dim i For i = 1 To 10 If shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Alias") = strArgument Then Exit For End If Next
' Connection alias is already Connection1 If i = 1 Then ExecuteSLX bolCont = False End If
' Exit if connection alias is not found If i = 11 Then MsgBox("Alias '" & strArgument & "' not found.") bolCont = False End If
If bolCont Then ' Get values of Connection i strAlias = shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Alias") strProvider = shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Provider") strInitialCatalog = shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Initial Catalog") strDataSource = shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Data Source") strExtendedProperties = shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Extended Properties")
' Replace connection i with values from Connection1 shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Alias", shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection1\Alias") shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Provider", shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection1\Provider") shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Initial Catalog", shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection1\Initial Catalog") shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Data Source", shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection1\Data Source") shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection" & i & "\Extended Properties", shell.RegRead("HKCU\Software\SalesLogix\ADOLogin\Connection1\Extended Properties")
' Update Connection1 with the connection i values shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection1\Alias", strAlias shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection1\Provider", strProvider shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection1\Initial Catalog", strInitialCatalog shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection1\Data Source", strDataSource shell.RegWrite "HKCU\Software\SalesLogix\ADOLogin\Connection1\Extended Properties", strExtendedProperties
End If
If bolCont Then ExecuteSLX End If
Set shell = Nothing End Sub
Sub ExecuteSLX Dim strExecFile strExecFile = ":\Program Files\SalesLogix\SalesLogix.exe"
Dim shell2, fso Set shell2 = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists("D" & strExecFile)) Then strExecFile = "D" & strExecFile ElseIf (fso.FileExists("C" & strExecFile)) Then strExecFile = "C" & strExecFile End If
shell2.Exec strExecFile
Set shell2 = Nothing End Sub
|
|
|
|
Re: Command Line Login
Posted: 17 May 07 11:55 AM
|
fiogf49gjkf0d Not putting a damper on this but, You can have multiple connections in the data link manager.. why not just change the drop down..
Currently I have
Prod 1 Prod 2 Dev 1 Dev 2
etc..
What advantage did you gain with the code.>? |
|
|
|
Re: Command Line Login
Posted: 17 May 07 1:06 PM
|
fiogf49gjkf0d The requirement was that a user have a different shortcut on their desktop for each database they would login to. All users login using NT authentication. They do not use the SalesLogix login.
NT Authentication and SalesLogix always uses Connection1 as the default database to login to. When NT authentication is used you are not given the chance to select which database to login to. The only way to login to another database would be to start the Sales Client and select Log Out from the File menu. Then you would have to use the SalesLogix login and change the database. This means the user will have to use their SalesLogix userid and password - NT Authentication would not apply. The SalesLogix login can be totally different than their NT login. So now you are left having to deal with users not knowing their SLX passwords and being confused about why the password is not the same as their network login.
A way around this would be to use the command line options for starting SalesLogix. But you are running into a security risk here because the only way you can use the Client command line options to automatically login to the database is by putting the user's password into the batch file.
As it stands, there is no way to switch between databases and login automatically without giving up security or the convenience of NT Authentication.
The advantage of the code I wrote is it takes care of making sure Connection1 is the database you want to automatically login to. This preserves the ability to use NT Authentication, is still secure and satisfies the user requirements.
John G.
|
|
|
|
Re: Command Line Login
Posted: 17 May 07 3:06 PM
|
fiogf49gjkf0d Thanks John, makes perfect sense.. not using the NT intergration at this time I wasn't aware of the limitation. |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|