Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Novell: ZENworks FAQ


Automation and Scripting by Provogeek
Posted: 7 Jul 05 (Edited 11 Jul 05)

As many of you may have found, a large part of a successful Zenworks deployment involves automation and scripting.  Many have used the easier to understand .BAT scripts to automate and provide the needed scripting functionality.  Others have found and learned VBS scripting.  Personally, I found VBS scripting to be pretty confusing and difficult to work with.  Recently I have run across a wonderful scripting engine that I have used at a few of my customer sites recently to solve some automation problems I was having.  This software package is called Auto IT and can be found at http://www.autoitscript.com/autoit3/  and the software is FREEWARE!!!  Do give these guys a donation, you will find this software to be easy to work with and can do some very wonderfully things.

Some examples of what I have done with this software;

This code was written for a customer who wants to use wireless PC's with no NetWare client using only the ZFD Agent logging in through a middle tier.  The problem; the workstation does not get an IP address until after desktop initialization.  This causes the login process to fail preventing policies and applications to be pushed through the agent.  To get a user logged in and to keep the whole process automated, I wrote this script to work with an executable provided by NTS to call the login.

; AutoIt Version: 3.1.0
; Language:       English
; Platform:       Win9x/NT
; Author:         Brent Schmidt (brent@kiscc.com)
; Script Function:
;   Logs user into eDirectory

SplashImageOn("Status", "C:\Zenworks\Splash_01.bmp", 287, 157, -1, -1, 1)    ; Place splash screen on desktop                              

$z = 0
    If @error = 0 Then
        Opt( "WinTitleMatchMode", 4 )
        Run( "C:\Zenworks\XTLoginW.exe -log c:\zenworks\errors.log" )
        WinWaitActive ( "classname=#32770" )
        ControlSend ( "classname=#32770", "", 104, "USERID" )
        ControlSend ( "classname=#32770", "", 106, "PASSWORD" )
        ControlSend ( "classname=#32770", "", 107, "{ENTER}" )
    ElseIf WinExists("Generic Host Process for Win32 Services") Then
        WinActivate("Generic Host Process for Win32 Services")
        Sleep (100)
Until $z = 1

; Inform user system is ready to use
MsgBox ( 64, "Ready", "The workstation is ready to use")

One of the biggest problems I had to over come was the sending of login data to the ZFD Agent login window.  When Novell coded the login process, they did not name the window. This meant that I could not call the window by name and send data to the specified window.  I had to use timing to call the executable, waiting for it to become active using a timer, then sending keyboard command to log the user in.  This caused issues with slower systems taking longer to load the executable.  It also left a window for a user to screw something up.  One of the advanced functions I found allowed me to call the window control ID instead.  This meant I did not have to use any timers and was able to send login data directly to the window specified and the user could not interfere with the process. Just took a little RTFM to find the answer to the problem.  I have found the manual to be very well written and the many examples included help as well.

AutoIT also includes a nifty program for getting window information.  AutoIT Window Info, just a simple program that when executed can provide you with the window name, control ID, button info, mouse and window position info.  

This script was used at a customer site to deploy the agent into the customers environment through the login script.  It employs a check to remove a previous desktop management package (LANDesk), verify the agent is installed already or not, and install if not done already.

; ----------------------------------------------------------------------------
; AutoIt Version: 3.1.0
; Author:       Brent Schmidt <Brent@kiscc.com>
; Company:    KIS Computer Center
; Date:        6/8/05
; Script Function:
;    Zenworks Workstation Agent Automated install
; ----------------------------------------------------------------------------
;     This scipt is intended to be used in a system login script to
;     detect workstations that do not have the ZFD Agent installed  # if
;     the agent is already installed, the script will bypass any attempts
;     to install the agent.

SplashTextOn ( " Help Desk", "PC Help Desk x7208 - PC software maintenance, do not interrupt this program...", 350, 170, -1, 0, 1,"Courier New Bold", 22, 800 )
Sleep (2000)
;     Check for and remove first the Intel LANDesk Mgmt Suite's remote Agent

If FileExists ( "c:\ldclient\wuser32.exe" ) Then
    SplashTextOn ( "Help Desk", "PC Help Desk x7208 - PC software maintenance, do not interrupt this program...", 350, 170, -1, 0, 1,"Courier New Bold", 22, 800 )
    RunWait ( "\\Apps01\APPS01\Applications.sys\Install\LANdesk.80\wscfg32 /f /u /noui /reboot" )
    SplashTextOn ( "Notice", "LANDesk Agent Removed", 200, 50 )
    Sleep (4000)
    SplashTextOn ( "Notice", "LANDesk Agent Already Removed", 200, 50 )
    Sleep (4000)

;     Read the workstation registry to detect if the ZFD Agent is already installed.

$ver = RegRead ( "HKLM\SOFTWARE\Novell\ZENworks\ZfD\Agent\Workstation Manager", "Version" )
If $ver = "" Then
    SplashTextOn ( "Notice", "Agent installed and current", 200, 50 )
    Sleep (4000)
    SplashTextOn ( "Help Desk", "PC Help Desk x7208 - PC software maintenance, do not interrupt this program...", 350, 170, -1, 0, 1,"Courier New Bold", 22, 800 )
    RunWait ( "msiexec.exe /i P:\install\ZFDAgent\ZfDAgent.msi /qb-! STARTUP_APPEXPLORER=1 ADDLOCAL=ALL LOGIN_PASSIVE_MODE=0 NAL_SINGLE_TREE=1" )


This script was used to deploy the ZFD agent to over 600+ desktops while the project was running, and there is an expected 2000+ more to be deployed after the engagement.  During the deployment, the only problems we ran into were workstations with out W2KSp4 or Xpsp1 (required) or systems with out IE6 installed.  Other issues that occurred were isolated problems not related to the deployment.  It worked great and just a couple of edit and I (and you) can use this script almost any ware to deploy the ZFD agent.

You will just need to play with the software to get familiar with it.  A couple of awesome features; you can compile a script into a self executable to be used on as many systems as you choose.  You do not need to install the scripting engine on all PC's the script gets used on.  You can even package files with in the executable for installs and deployments.  

For personal use, I have used this script engine to write a remote console tool to administer a game server from a remote client.  It just provide a GUI front end for the DOS program running in the back ground.  The possibilities and uses of this software are enormous and I use it very often now to solve all of my automation and scripting needs.

This software is awesome, you MUST check it out.

Back to Novell: ZENworks FAQ Index
Back to Novell: ZENworks Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close