[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1160
  • Last Modified:

Windows script to un-install and install citrix ica

we want to upgrade the citrix client installed on our client machines and the recommendation is to un-install the old version and install the new version.

the citrix ica client is displayed in the add/remove programs is like

metaframe presentation server web client for win32.

we need to un-install this client and immediately reinstall an .msi shared on a network shared folder. the .msi is a silent install. the version on the client we have currently installed is 9.00. moreover the script i have does not include code to install the new client which is a .msi file on a network share.

can someone review the script and help me out

I found a script but does not see to be working

the script I have is attached
On Error Resume Next
Const strComputer = "."
Const strLogFile = "c:\UninstallLog.txt"
Const strClientName = "metaframe presentation server web client for win32"
Const ForAppending = 8
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("WScript.Network")
    If objFSO.FileExists(strLogFile) = False Then
        Set objTextFile = objFSO.OpenTextFile(strLogFile, ForAppending, True)
        Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
        Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product Where Name = '" & strClientName & "'")
        For Each objSoftware in colSoftware
            On Error Resume Next
            Err.Clear
            objTextFile.WriteLine(WshNetwork.ComputerName & Space(1) & ":" & Space(1) & "Uninstalling" & Space(1) & objSoftware.Name & Space(1) & "from" & Space(1) & objSoftware.Vendor)
            objSoftware.Uninstall()
            If Err then
                objTextFile.WriteLine("Error : " & Err.Number & " => " & Err.Description)
            End If
        Next
    End If

Open in new window

0
mgmohiuddin
Asked:
mgmohiuddin
3 Solutions
 
mgmohiuddinAuthor Commented:
i also found another one and does not work its a batch file


 Re: automate uninstall ica client 
Posted: May 2, 2006 11:07 AM    in response to: bjorn bats         Reply  
  0 users found this post useful  
 
He is an example of a "Complete" uninstall script that would detect the presense of the client and unintall it.

IF EXIST C:\WINDOWS\INF\wficat.inf RunDll32 ADVPACK.DLL,LaunchINFSection C:\WINDOWS\INF\wficat.inf,DefaultUninstall
IF EXIST C:\WINNT\INF\wficat.inf RunDll32 ADVPACK.DLL,LaunchINFSection C:\WINNT\INF\wficat.inf,DefaultUninstall
IF EXIST C:\WINDOWS\system32\ctxsetup.exe Script.exe
IF EXIST C:\WINNT\system32\ctxsetup.exe Script2000.exe
MsiExec.exe /X{DF1D5FEC-D67C-43C8-9230-41F5DF350196} /QUIET

First two lines check to see if the Web Client is installed based on OS (Windows XP and Windows 2000) and if installed, uninstall.

The next two lines check to see if any clients are installed using a older .exe file and then calls a script (as I mentioned in my first post) to uninstall (again, based on version of OS).

The last line will uninstall any MSI installed clients.

You might want to add a:

RD /S /Q C:\Progra~1\Citrix

at the end which would remove the Citrix Directory and all files and folders in it 

Open in new window

0
 
Jared LukerCommented:
Go through this registry key until you find "metaframe presentation server web client for win32"

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Report back with the UninstallString for that product.
0
 
markdmacCommented:
As Jared says, get us the uninstall string and then tell us the path where the new MSI is located and we can easily script that.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
RobSampsonCommented:
Hi there, this script should read the registry value to obtain the uninstallstring, and then uninstall it if it exists.

Then you can point the \\Server\Software\Citrix\WebClient\ica32web.msi to the MSI of your new client, and it should install that too.

Regards,

Rob.
Set objShell = CreateObject("WScript.Shell")
On Error Resume Next 
strUninstallString = objShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\MetaFrame Presentation Server Web Client for Win32\UninstallString")
If Err.Number = 0 Then
	boolOldClientFound = True
Else
	boolOldClientFound = False
End If
Err.Clear
On Error Resume Next
If boolOldClientFound = True Then intReturn = objShell.Run(strUninstallString, 1, True)
strCommand = "msiexec /i \\Server\Software\Citrix\WebClient\ica32web.msi /qn ENABLE_DYNAMIC_CLIENT_NAME=Yes ENABLE_SSON=Yes ALLOW_REBOOT=No"
objShell.Run strCommand, 1, True

Open in new window

0
 
mgmohiuddinAuthor Commented:
NO dosent work

now i know it is a different question all to gether. if you want i could close this one a post a new question. we tested these options and are not meeting our needs as we want our deployment/upgrade to be phased and login script and GPO is not meeting our requirements

the management wants us to use SCCM to deploy and the sequence should be as follows

1. display a message to the user that his client is being upgraded and close all ica sessions
2. for people who do not close kill the ica session
3. make sure de does not reopen it by blocking 3 url's from where he can open a new session
4. upgrade the client using silent install
5. unblock the 3 blocked url's

all te clients open citrix applications using web interface and ica files on the portal. thats why we want to block the url's for the time of the upgrade
0
 
Jared LukerCommented:
Yea... new question... :)
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now