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
            objTextFile.WriteLine(WshNetwork.ComputerName & Space(1) & ":" & Space(1) & "Uninstalling" & Space(1) & objSoftware.Name & Space(1) & "from" & Space(1) & objSoftware.Vendor)
            If Err then
                objTextFile.WriteLine("Error : " & Err.Number & " => " & Err.Description)
            End If
    End If

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

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


Report back with the UninstallString for that product.
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.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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.


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
	boolOldClientFound = False
End If
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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Jared LukerCommented:
Yea... new question... :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.