Re: Upgrade of agent from IR3 or earlier to IR4 or IR4hp1 breaksagent
Here is the "Final" fix. I made a new simple application object that
calls a batch file called zi.bat (zen install) This is the brute force
overkill nuke the previous installation fix. In order to determine if
the ZDM7 SP1 IR4 HP1 agent is installed, I set the requirements of the
application to check the file version of C:\Program
Files\Novell\ZENworks\ZenLite.dll < 7.0.1.16. There may be another way
to do this but that works as previous agents have a lower version of
that file so it was an idea comparison.
Note,my users are local admins (don't start on me about that), and I'm
not having to deal with elevated privilege issues which you may run if
your users are locked down.
Here's the contents of zi.bat (paths will need to be changed to match
your own setup) Various versions of the Zen agent from 4.x up had
different names for the remote management agent service. I wanted to be
thorough so I stop them all in case I re-image an old machine with an
old image that had ZFD 4 on it or something because I never got around
to updating it, and this script attempts to upgrade it. I make no
claims that this is by any means pretty. Enjoy.
Below is zi.bat
--------------------- (don't include this line)
net stop "Remote Management Agent"
net stop "Novell ZENworks Remote Management Agent"
net stop "Novell ZFD Remote Management"
net stop "Workstation Manager"
net stop "Novell Application Launcher"
net stop "Novell XTier Agent Services"
\\npv1\sys\public\pskill.exe -t zenrem32.exe
\\npv1\sys\public\pskill.exe -t nalntsrv.exe
\\npv1\sys\public\pskill.exe -t NalView.exe
\\npv1\sys\public\pskill.exe -t NALWIN32.EXE
\\npv1\sys\public\pskill.exe -t NalWin.exe
\\npv1\sys\public\pskill.exe -t NalDiag.exe
\\npv1\sys\public\pskill.exe -t NALDESK.EXE
\\npv1\sys\public\pskill.exe NalAgent.exe
set errorlevel=0
zwsreg -unreg
T:\applications\Novell\Zenworks\ZDM7\Zenrem.vbs
msiexec /i "T:\applications\Novell\Zenworks\ZDM7\ZfDAgent.msi "
TRANSFORMS="T:\applications\Novell\Zenworks\ZDM7\z fdagent.mst" /qb-!
/forcerestart
If you notice, that file calls a Zenrem.vbs a few lines from the bottom.
That's the script that uninstalls the previous version.
Also note that when I use pskill.exe I intentionally do not use the -t
option (kill processes and it's descendants) on NalAgent.exe. Using -t
will kill the batch file as well and it won't work. pskill.exe was
part of sysinternals and is freely available for download.
Here's the contents of the uninstaller script. It's useful for
uninstalling any application. Just change "ZENworks Desktop Management
Agent" to the application name you wish to uninstall.
Below is zenrem.vbs
--------------------- (don't include this line)
Function GetProductCode(productName)
'// Default to empty variable return
GetProductCode = vbEmpty
'// Variables
Dim installer: Set installer = CreateObject("WindowsInstaller.Installer")
Dim productCode
Const msiOpenDatabaseModeReadOnly = 0
Const msiInstallStateNotUsed = -7
'// Check for obj err
If err.number <> 0 Then Exit Function
'// Verify the client is available to find
If installer.ProductState(productName) <> msiInstallStateUnknown Then
'// Search for the client
For Each productCode In installer.Products
If LCase(productName) = LCase(installer.ProductInfo(productCode,
"ProductName")) Then
GetProductCode = productCode
Exit Function
End If
Next
Else
'// Client isn't installed or cannot be found by the correct name
End If
End Function
pcode = GetProductCode("ZENworks Desktop Management Agent")
If pcode <> "0" then
Dim oShell
Set oShell = WScript.CreateObject ("WScript.shell")
oShell.run "msiexec /x"&pcode&" REBOOT=ReallySuppress /passive",1,true
Set oShell = Nothing
End If
|