Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Zenworks 4x - 7.x Workstation Agent Automated Deployment

Deployment

Zenworks 4x - 7.x Workstation Agent Automated Deployment

by  Provogeek  Posted    (Edited  )
The following script will greatly ease the deployment of the Zenworks Agent to a Novell NetWare Network. It can also be used in a Microsoft Windows Network with little modification. It can also be used in a current Zenworks deployment being called by NAL instead of executed through the login script.

The script can be compiled into a stand-alone executable using the Free ware software called AutoIT. You can find this software here http://www.autoitscript.com/autoit3/

Code:
#cs --------------------------------------------------------------------------------------------------------------------------------------------------------



 AutoIt Version: 3.1.0

 Author:        Brent Schmidt <Brent [AT] kiscc [DOT] com>

 Company:	KIS Computer Center
 Date:		4/11/07



 Script Function:

	Zenworks Workstation Agent Automated Install



This script is intended to be used in a system login script to detect workstations that do not have the ZFD Agent installed, check workstation For

minimum requirements and report any errors it encounters,  if the agent is already installed, the script will bypass any attempts to install the agent.



Change Log:

6/8/05 - original version

7/20/05 - removed LANdesk detection and removal

11/29/05 - added OS version, support pack, and IE version detection and error reporting

12/20/06 - added alternate credential installation support

4/11/07 - Added failed authentication detection and reporting for alternate credentials.

4/16/07 - Optimized code



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

Declaration of variables to be used for the checking function of the script.



ZfDVer checks the agent registry entries to see what version of the ZfD agent is install on the PC

Reported is a custom registry entry that gets created when the script run to prevent repeat error reporting

IEver checks the version attribute on the iexplorer.exe to determine the version of Internet Explorer

#ce --------------------------------------------------------------------------------------------------------------------------------------------------------

Dim $ZfDver = RegRead ( "HKLM\SOFTWARE\Novell\ZENworks", "Version" )

Dim $Reported = RegRead ( "HKLM\SOFTWARE\Novell\Distro", "Reported" )

Dim $IEver = FileGetVersion("C:\Program Files\Internet Explorer\iexplore.exe")

#cs --------------------------------------------------------------------------------------------------------------------------------------------------------

ZfD Agent version checking, Internet Explorer version checking, and OS version [service pack level] checking.



The ZfD agent checking is absolute and not a minimum range to ensure all workstation the script touches will be updated.  There have been cases where a PC

has a previous version of the agent deployed to it for unknown reasons and the deployment through NAL did not work.  The section will detect those that Do

not have the version wanted on all PC's then tell you why it failed if an attempt to install was done through NAL.



The most common reasons for an installation failure are due to the Internet Explorer version not being the minimum or the service pack level Not

being the minimum for the OS the agent is being installed on to.

#ce --------------------------------------------------------------------------------------------------------------------------------------------------------

If $ZfDver = "7.0.1.60523" Then

	Exit

ElseIf $IEver < "6.0.000.0000" Then

	ReportError("IE")

Else

	If @OSVersion = "WIN_XP" Then

		If @OSServicePack = "Service Pack 1" Then

			InstallZfD()

		ElseIf @OSServicePack = "Service Pack 2" Then

			InstallZfD()

		Else

			ReportError("SP")

		EndIf

	ElseIf @OSVersion = "WIN_2000" Then

		If @OSServicePack = "Service Pack 4" Then

			InstallZfD()

		Else

			ReportError("SP")

		EndIf

	ElseIf @OSVersion = "WIN_98" Then

		If @OSServicePack = "A" Then

			InstallZfD()

		Else

			ReportError("SP")

		EndIf

	Else

		ReportError("OS")

	EndIf

EndIf

#cs --------------------------------------------------------------------------------------------------------------------------------------------------------

Error reporting function



When an error is detected, this function is called to report the type of error being reported to a syslog server.  This script was written to use the Kiwi

Syslog Daemon server (http://www.kiwisyslog.com/syslog-info.php).  Other types of Syslog server can be used, but you may need to modify the command line 

being used to communicate with other Syslog server.  The client software being used is a Kiwi Logger (http://www.kiwisyslog.com/logger-info.php).  You will

want to install this logger tool then find the executable klogwin.exe.



For reporting to function properly. Install the Syslog server onto a Windows machine (workstation or server) with a static IP address.  Edit the IPADDRESS In

this script to match the IP address of your Syslog server.  Then place the klogwin.exe into a public network folder that all user have mapped as a search drive 

and have read/filescan rights to.  The script it's self should also be placed into a public search drive for execution.

#ce --------------------------------------------------------------------------------------------------------------------------------------------------------

Func ReportError($error)

	If $Reported = "1" Then

		Exit

	ElseIf $error = "SP" Then

		Run ( "klogwin.exe -h IPADDRESS -m " & '"' & @ComputerName & " is " & @OSVersion & " " @OSServicePack & " needs current service pack installed for ZfD deployment" & '"' )

		RegWrite ( "HKLM\SOFTWARE\Novell\Distro", "Reported", "REG_SZ", "1" )

	ElseIf $error = "OS" Then

		Run ( "klogwin.exe -h IPADDRESS -m " & '"' & @ComputerName & " uses " & @OSVersion & " " @OSServicePack & " which is an unsupported operating system" & '"' )

		RegWrite ( "HKLM\SOFTWARE\Novell\Distro", "Reported", "REG_SZ", "1" )

	ElseIf $error = "IE" Then

		Run ( "klogwin.exe -h IPADDRESS -m " & '"' & @ComputerName & " has Internet Explorer version " &  $IEver & " IE6 will need to be installed" & '"' )

		RegWrite ( "HKLM\SOFTWARE\Novell\Distro", "Reported", "REG_SZ", "1" )

	ElseIf $error = "AD" Then

		Run ( "klogwin.exe -h IPADDRESS -m " & '"' & @ComputerName & " Failed to Install ZfD Agent, unable to authenticate as administrator" & '"' )

		RegWrite ( "HKLM\SOFTWARE\Novell\Distro", "Reported", "REG_SZ", "1" )

	EndIf

	Exit

EndFunc

#cs --------------------------------------------------------------------------------------------------------------------------------------------------------

Zenworks for Desktops Agent Deployment Function



This function will display a pop-up window on the users screen to tell them what is going on (highly recommended to do so, don't keep users in the dark and 

perform a silent install.  Would be prone to user error if the turn their PC's off in the middle of an install).  



It will then copy the agent installer down to the local drive and place it into the users temp directory.  This is needed because the RunAs with in AutoIT  

and the Windows RunAs tool both fail to run a program from a network drive in a Non-Active Directory environment (currently untested by me in an AD environment)



the script pauses for a couple of seconds to allow the file to complete it's copy and for the hard drive to flush cash to disk (going to fast results in file 

copy errors.



The script will then pass local administrator authentication to the system and all Run commands afterwards will use that authentication to execute.  When the 

installer runs, it will produce an execution failure if the local admin rights not present and report an error to the Syslog server to let IT know what system

failed to run the installer.



If end users are administrators of their local PC's the authentication routine is not needed and can be remarked out of execution.



If end users are NOT administrators of their local PC's and there is no common administrator password, this script will not work for you.

#ce --------------------------------------------------------------------------------------------------------------------------------------------------------

Func InstallZfD()

	Opt( "RunErrorsFatal", 0 ) 

	SplashTextOn ( "Window Title", "Message to be displayed to the user", 450, 270, -1, 0, 0,"Tahoma Bold", 22, 800 )

	FileCopy ( "\\UNC\PATH\TO\ZfDAgent.msi", @TempDir, 1)

	Sleep (5000)

	RunAsSet ( "administrator", @ComputerName, "PASSWORD" )

	$result = RunWait ( "msiexec.exe /i " & @TempDir & "\ZfDAgent.msi /qb-! STARTUP_APPEXPLORER=1 STARTUP_APPWINDOW=0 ADDLOCAL=ALL LOGIN_PASSIVE_MODE=0 NAL_SINGLE_TREE=1 ZENWORKS_TREE=NAME", @UserProfileDir )

	If @error Then

		RunAsSet()

		SplashTextOn ( "Window Title", "There was a failure in the installation of Zenworks on your PC, the help desk has been notified of this failure", 450, 270, -1, 0, 0,"Tahoma Bold", 22, 800 )

		Sleep (5000)

		ReportError("AD")

	EndIf

	SplashOff ()

	Exit

EndFunc
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top