Skip to main content

Automatically Connecting Domino Console to Many Domino Servers

Web Doc

Note: This is publication is now archived. For reference only.

thumbnail 

Published on 12 August 2004, updated 18 August 2004

  1. View in HTML

Share this page:   

IBM Form #: TIPS0439


Authors: Andreas Dr Gallus

    menu icon

    Abstract

    Domino 6 contains a new tool to monitor and administer a Lotus Domino server: the Domino Console. In contrast to the well-known Administrator Client, Domino Console allows you to connect to more than one server at the same time. However, it does not allow you to automate the logon process. Therefore, if you need to connect to many Domino servers, such as after restarting a z/OS or z/VM system, you have to enter a lot of user IDs, passwords, and server names, for example.

    This Technote explains how to automate this process. It's as simple as building a configuration file with the information for your Domino servers and running the script that is provided. For additional questions, contact Dr. Andreas Gallus of IBM Germany at a.gallus@de.ibm.com.

    Contents

    Domino Controller and Domino Console
    The Domino Controller and Domino Console are two features to administer a Domino 6 (or later) server. Both features work together to provide administrators with secure access to Domino servers from any location. This is the preferred method to remotely control your server. The files needed to run the Domino Controller and Domino Console are provided with Domino and Notes.

    Domino Controller is new Java code that you can use to start the Domino 6 server. It intercepts the output from the server and writes it to any connected Domino Consoles. Optionally, the Domino Controller writes the output to log files on the server rather than to the server's standard output location (usually the screen).

    Domino Console is a new Java-based graphical user interface (GUI) that an administrator can use on a local machine to connect to a Domino 6 server that is run by a Domino Controller, even to a server that is not responding to Notes clients. From Domino Console, administrators securely send commands to be executed either in the Domino server or natively, by the operating system. The Domino Console functions strictly as a server console. You can use it to connect to a Domino Controller to monitor and issue commands to the server. However, it does not include the full set of Domino administration features that are available with the Domino Administrator and the Web Administrator. Nor can you use it to open and manage Notes databases.

    You can also use Domino Console as an alternate, secure way to connect to a system running Domino. It offers the ability to issue shell or controller commands.

    The built-in capabilities of the Domino Console to connect or disconnect a Domino Controller are fine for reaching a small number of servers. However, if an administrator needs to connect to many servers at the same time, for example after an initial program load (IPL) of a z/VM system running dozens of Linux and Domino servers, you want a more sophisticated way than to manually open the connecting window and type a user ID, password, and server name.

    This short script helps to solve this problem. The script is written in Microsoft Visual Basic and runs under Windows Script Host.

    Windows Script Host


    Windows shell scripting and the Windows Script Host are powerful scripting languages that enable users and administrators to automate many repetitive tasks. Scripts are not only more efficient, but they reduce the possibility of error and ensure a consistent methodology. Once written, a script can be executed as many times as necessary, while a manual procedure must be performed from start to finish, time and time again. While scripts can be used to develop incredibly complex and detailed processes, most scripts are usually rather small, sometimes as brief as a few dozen lines.

    Windows Script Host is ideal for non-interactive scripting needs, such as logon scripting, administrative scripting, and machine automation. Windows Script Host is a Windows administration tool. It creates a runtime environment for scripts. That means that Windows Script Host plays the part of the host; it organizes objects and services available for the script and provides a set of guidelines within that define the environment where the script is executed. Also Windows Script Host handles security issues and invokes the appropriate script engine. Some examples where Windows Script Host scripts can be useful include creating user and group accounts, automating system backups or other repetitive tasks, and managing Windows services.

    Windows Script Host objects and services


    Windows Script Host provides several objects for direct manipulation of script execution, as well as helper functions for other actions. Using these objects and services, you can accomplish such tasks as:
    • Print messages to the screen
    • Run basic functions such as CreateObject and GetObject
    • Map network drives
    • Connect to printers
    • Retrieve and modify environment variables
    • Modify registry keys

    The script


    As mentioned earlier, the script is written in Visual Basic. The following example must be executed in C:\domcon, in which the configuration file must exist. To run this example, we completed the following steps:
    1. Define the variables and the constants, such as comment and separator characters, the path and default name for the configuration file, the name of the Domino Console window, and the path to the Domino Console executable.
    2. Initialize the Visual Basic Scripting (VBS) objects needed to run the script.
    3. Optionally prompt the user for the configuration file name. Notice that the script itself does not check whether the configuration file exists. This is done by the Windows Script Host.
    4. Check whether the Domino Console is still running. If not, start it.
    5. The script brings the Console window to the foreground and starts to connect to the servers defined in the configuration file. The WScript.Sleep statement pauses the execution of the script for a defined time in milliseconds. This is done to make sure the workstation has enough time to do what the script requested.

    From there, the following actions occur:
    1. The main part of the script has two nested loops where the configuration file is read and interpreted. The script splits the line into three parts divided by the separator character.
    2. A Ctrl+O is sent to the Domino Console window as an “open server” command.
    3. The pop-up window is filled with the parameters received from the configuration file. Notice that before the server name is sent, the script deletes the default entry.
    4. The script skips the PORT field, sends an “OK” , and waits for a few seconds to give the Domino Console time to establish the server connection.

    Here is the listing of the VBS script:

    ---------------------------- domcon.vbs ---------------------------------------

    Dim Wsh, fs, ts, filename, filepath, jconsole, jconsole_name

    Dim i, parms(3), s, st, sl, position, box


    '*** Define the constants used in this script ***

    Const separator = " " '*** separator character used in config. file ***

    Const comment = "#" '*** comment character used in config. file ***

    Const ForReading = 1 '*** file mode ***

    '*** Define default path and name of the configuration file ***

    filepath = "C:\domcon\"

    filename = "domcon.cfg"

    '*** Define path and name of DominoConsole programm ***

    jconsole = "C:\Lotus\notes\jconsole.exe"

    '*** Define the window caption of the Domino Console window ***

    jconsole_name = "Lotus Domino Console"

    '*** Initiate the objects needed in this script ***

    Set fs = CreateObject( "Scripting.FileSystemObject")

    Set Wsh = Wscript.CreateObject( "Wscript.Shell")

    ‘*** Ask for the filename of the configuration file ***

    filename = InputBox( "Enter the name of the configuration file.”, “Configfilename ?")

    filename = filepath + filename

    Set ts = fs.OpenTextFile( filename, ForReading)

    '*** Print warning not to use mouse and keyboard during the script ***

    box = MsgBox( "Please do not use the keyboard or mouse during the script", 4128, "Important Notice!")

    '*** Check if Domino Console runs, if not: ***

    '*** start the Domino Console, give it time to initialize ***

    '*** In any case: bring the Console window to front ***

    If( Not Wsh.AppActivate( jconsole_name)) Then

    Wsh.Exec( jconsole) :

    WScript.Sleep 6000 :

    Wsh.AppActivate jconsole_name :

    End If

    WScript.Sleep 1000

    '*** Read the config file line by line till EOF ***

    Do While Not ts.AtEndOfStream

    s = ts.ReadLine

    sl = Len( s)

    i = 1

    k = 1

    Position = 1

    '*** split the line into servername, username, passwort ***

    Do While k < 3

    Do While i < sl

    st = Mid( s, i, 1)

    If( st = separator) Then

    Exit Do

    End If

    i = i + 1

    Loop

    parms( k) = Mid( s, position , i - position)

    position = i + 1

    i = i + 1

    k = k + 1

    Loop

    parms( 3) = Mid( s, position)

    st = Mid( s, 1, 1)

    '*** If first charakter indicates a line with comment - ignore it ***

    If( Not st = comment) Then

    '*** Send the OPEN NEW SERVER command to DominoConsole and ***

    '*** send all the expected parameters (server, user, passwort)***

    Wsh.SendKeys "^o" :

    WScript.Sleep 2000 :

    wsh.SendKeys parms( 2) :

    WScript.Sleep 500 :

    wsh.SendKeys "{TAB}" :

    wsh.SendKeys parms( 3) :

    WScript.Sleep 500 :

    wsh.SendKeys "{TAB}+{END}{BS}" :

    WScript.Sleep 500 :

    wsh.SendKeys parms( 1) :

    WScript.Sleep 500 :

    wsh.SendKeys "{TAB}{TAB}{ENTER}" :

    WScript.Sleep 6000 :

    End If

    Loop

    '*** Close the configurations file and finish the script ***

    ts.Close

    box = MsgBox( "Script has finished the keyboard is yours again ...", 64, "everything is fine")

    ------------------------------------------------------------------------------

    The configuration file


    Everything the script needs to know to connect the Domino Console to the Domino server is placed in a configuration file. The path to this file is defined inside the script with the filepath variable. The file name can either be defined in the script (via a filename variable) or you can prompt the user for it.

    Here is an example of a configuration file:

    ---------------------------- domcon.cfg ---------------------------------------

    #Server_name User_name Password

    #127.0.0.1 admin password

    server1 admin1 password1

    server2 admin2 password2

    server3 admin3 password3

    # This is a comment.

    --------------------------------------------------------------------------------

    The configuration file is read line by line. If the first character is the pound symbol (#), then the rest of the line is ignored. Each line defines one server connection. Parameters are separated by a space ( ). The first parameter is the server name, the second is the user ID, and the last one is the password for this server-user combination. The characters used as a separator and comment indicator can be defined in the script using the separator and comment variables.

    Note: The passwords are stored in clear text inside the configuration file. Therefore, we recommend that you place this script only on machines that are physically protected and accessed only by authorized personnel. This is true for a workstation that serves as a console machine in the operating room.

    Summary


    Using a short VBS script to automate the logon procedure for the Domino Console can save you a lot of repetitive typing. You can easily specify various configuration files for a particular set of Domino servers that you want to monitor.

    Although it is just a small tool, here are some ideas for future improvements:

    • Find a secure way to store the password in the configuration file.
    • If a server is already connected, the script will run into an error. Further experimentation is necessary to solve this.
    • Because the script just simulates keystrokes, it is not possible to close the Domino Console window while the script is running. This may have strange and unpredictable results on your Windows system.
    • For the same reason, it is not a good idea to bring other program windows to the foreground while the script is running.
    • The script could be extended to automatically start and stop the Domino servers using the Domino Controller.

    Appendix: Related publications


    This appendix cites helpful references to more information about Domino Console and Windows Script Host.

    Windows Script Host


    Windows Script Host is built into Microsoft Windows 98, 2000, and XP. If you are running Windows 95, you can download Windows Script Host 5.6 from the Microsoft Web site at: http://msdn.microsoft.com/scripting.

    To download the official Help file from Microsoft for Windows Script Host, go to:

    http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

    For more information about Windows Script Host and the use of scripts for Windows operating systems, see:

    • VBScript in a Nutshell, 2nd Edition by Paul Lomax, Matt Childs, and Ron Petrusha (0'Reilly, March 2003; ISBN 0-596-00488-5)
    • Windows Admin Scripting Little Black Book, 2nd Edition by Jesse M. Torres (Paraglyph Press, January 2004; ISBN 1-932111-87-5)

    Domino Console
    The best source for reading about the Domino console is the Administrator Help for Domino 6:

    http://www-12.lotus.com/ldd/doc/domino_notes/6.5.1/help65_admin.nsf/Main?OpenFrameSet

     

    Special Notices

    The material included in this document is in DRAFT form and is provided 'as is' without warranty of any kind. IBM is not responsible for the accuracy or completeness of the material, and may update the document at any time. The final, published document may not include any, or all, of the material included herein. Client assumes all risks associated with Client's use of this document.