Acrobat Uninstall Script
Hi,
I'm looking to create a script that I can deploy via SMS across our entire organisation that will uninstall any versions of Acrobat previous to 7.0.7 and install our packaged version of Acrobat 7.0.8
I'm looking at a VBS Script at the moment, but not sure where to start as I'm new to scripting. Any tips?
Thanks
- paul
I'm looking to create a script that I can deploy via SMS across our entire organisation that will uninstall any versions of Acrobat previous to 7.0.7 and install our packaged version of Acrobat 7.0.8
I'm looking at a VBS Script at the moment, but not sure where to start as I'm new to scripting. Any tips?
Thanks
- paul
0 Comments
[ + ] Show comments
Answers (7)
Please log in to answer
Posted by:
danr29
17 years ago
I think I got this script from oldapps.com (not sure-just know I didn't write it but I did modify it to include 3 legacy versions of acrobat). I've used this in a custom action with the latest version of Reader (in the Execute Deferred seq) and it worked perfectly:
On error resume next
const HKLM = &H80000002
Set objShell = CreateObject("Wscript.Shell")
sCmd1 = "C:\WINDOWS\ISUNINST.EXE -y -a" _
& " -f""C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu"""
sCmd2 = "C:\WINDOWS\ISUNINST.EXE -y -a" _
& " -f""C:\Program Files\Common Files\Adobe\Acrobat 4.0\NT\Uninst.isu"""
sCmd3 = "C:\WINDOWS\UNINST.EXE -y -a" _
& " -f""C:\Acrobat3\Reader\DeIsL1.isu"""
If keyExists("\Software\Adobe\Adobe Reader\5.0\", HKLM) Then
objShell.Run sCmd1
End If
If keyExists("\Software\Adobe\Adobe Reader\4.0\", HKLM) Then
objShell.Run sCmd2
End if
If keyExists("\Software\Adobe\Adobe Reader 3.1\", HKLM) Then
objShell.Run sCmd3
End If
On error resume next
const HKLM = &H80000002
Set objShell = CreateObject("Wscript.Shell")
sCmd1 = "C:\WINDOWS\ISUNINST.EXE -y -a" _
& " -f""C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu"""
sCmd2 = "C:\WINDOWS\ISUNINST.EXE -y -a" _
& " -f""C:\Program Files\Common Files\Adobe\Acrobat 4.0\NT\Uninst.isu"""
sCmd3 = "C:\WINDOWS\UNINST.EXE -y -a" _
& " -f""C:\Acrobat3\Reader\DeIsL1.isu"""
If keyExists("\Software\Adobe\Adobe Reader\5.0\", HKLM) Then
objShell.Run sCmd1
End If
If keyExists("\Software\Adobe\Adobe Reader\4.0\", HKLM) Then
objShell.Run sCmd2
End if
If keyExists("\Software\Adobe\Adobe Reader 3.1\", HKLM) Then
objShell.Run sCmd3
End If
Posted by:
dunnpy
17 years ago
Paul,
I'm quite sure that 7.08 will go over (replace) any versions of Adobe Reader from 6.0.
This only leaves probably 4 & 5 to remove.
If you download the old versions (if you don't have them) from www.oldapps.com and check out the uninstall commands - I think they may be similar/same for all previous versions.
If you run these uninstalls as custom actions in your MST you should be able to remove any versions that Adobe Reader can't handle itself.
Hope this helps,
Dunnpy
I'm quite sure that 7.08 will go over (replace) any versions of Adobe Reader from 6.0.
This only leaves probably 4 & 5 to remove.
If you download the old versions (if you don't have them) from www.oldapps.com and check out the uninstall commands - I think they may be similar/same for all previous versions.
If you run these uninstalls as custom actions in your MST you should be able to remove any versions that Adobe Reader can't handle itself.
Hope this helps,
Dunnpy
Posted by:
pmp75
17 years ago
Posted by:
pmp75
17 years ago
Thanks, the small scale tesitng I've done has this working fine..
- paul
- paul
ORIGINAL: danr29
I think I got this script from oldapps.com (not sure-just know I didn't write it but I did modify it to include 3 legacy versions of acrobat). I've used this in a custom action with the latest version of Reader (in the Execute Deferred seq) and it worked perfectly:
On error resume next
const HKLM = &H80000002
Set objShell = CreateObject("Wscript.Shell")
sCmd1 = "C:\WINDOWS\ISUNINST.EXE -y -a" _
& " -f""C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu"""
sCmd2 = "C:\WINDOWS\ISUNINST.EXE -y -a" _
& " -f""C:\Program Files\Common Files\Adobe\Acrobat 4.0\NT\Uninst.isu"""
sCmd3 = "C:\WINDOWS\UNINST.EXE -y -a" _
& " -f""C:\Acrobat3\Reader\DeIsL1.isu"""
If keyExists("\Software\Adobe\Adobe Reader\5.0\", HKLM) Then
objShell.Run sCmd1
End If
If keyExists("\Software\Adobe\Adobe Reader\4.0\", HKLM) Then
objShell.Run sCmd2
End if
If keyExists("\Software\Adobe\Adobe Reader 3.1\", HKLM) Then
objShell.Run sCmd3
End If
Posted by:
dunnpy
17 years ago
pmp75,
I've just installed 6.02 and installed 7.08 over the top.
Version 6.02 has been removed and replaced by 7.08
I thought this was the case from when I developed a 7.08 package.
Just out of curiosity, why are people looking at 7.08 when it was replaced by 7.09 and now 8.0 is available?
Thanks,
Dunnpy
I've just installed 6.02 and installed 7.08 over the top.
Version 6.02 has been removed and replaced by 7.08
I thought this was the case from when I developed a 7.08 package.
Just out of curiosity, why are people looking at 7.08 when it was replaced by 7.09 and now 8.0 is available?
Thanks,
Dunnpy
Posted by:
pmp75
17 years ago
Posted by:
shawnsccm1986
13 years ago
Here is an example of my adobe standard uninstall, written in VS2008 as a console application. As you can see we query the SCCM tables for a few values, the neat one is the unique ID which means any new versions of adobe and we dont need to change the installer with a hard coded product code string.
Module Module1
Sub Main()
Dim uniqueid As String = String.Empty
Dim compname As String = My.Computer.Name
Dim useraweekago As String = String.Empty
Dim fullusername As String = String.Empty
My.User.InitializeWithWindowsUser()
Dim username As String = Replace(My.User.Name, "yourdomain\", "")
Dim Application As String
Dim SCCMAllow As String
Application = "Adobe Standard"
SCCMAllow = "SCCM - Allow Adobe Standard"
Dim mail As New System.Net.Mail.SmtpClient("123.123.123.123")
Dim address As New System.Net.Mail.MailAddress("donotreply@yourdomain.com")
Dim toAddress As New System.Net.Mail.MailAddress("youraddress@yourdomain.com")
Dim message As New System.Net.Mail.MailMessage(address, toAddress)
Dim strsubject As String
Dim strbody As String
strsubject = "SCCM Application Uninstall - " & Application & ""
message.IsBodyHtml = True
message.Subject = strsubject
Try
Dim conn As New SqlClient.SqlConnection("Data Source=glasms;" + "Initial Catalog=SMS_GLA;" + "User ID=******;" + "Password=*******;")
Dim cmd As New SqlClient.SqlCommand
cmd.CommandTimeout = 60
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "select full_user_name0 from user_disc where user_name0 = '" & username & "'"
conn.Open()
fullusername = (cmd.ExecuteScalar)
conn.Close()
Catch ex As Exception
System.Environment.Exit(1)
End Try
'first off because its adobe standard and lots of secretarys have it on desktops that can be used
'by visiting people, we are going to query the sms database to find out who was logged on 7 days
'ago. if the initialized user doesnt match we will abort the uninstall.
Try
Dim conn As New SqlClient.SqlConnection("Data Source=glasms;" + "Initial Catalog=SMS_GLA;" + "User ID=*****;" + "Password=*******;")
Dim cmd As New SqlClient.SqlCommand
cmd.CommandTimeout = 60
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "select replace(name00,'yourdomain\',') from network_login_profile_hist osd join system_data sys on sys.machineid = osd.machineid where osd.fullname00 is not null and lastlogon00 < (getdate() - 7) and sys.name0 = '" & compname & "' order by lastlogon00 desc"
conn.Open()
useraweekago = (cmd.ExecuteScalar)
conn.Close()
Catch ex As Exception
System.Environment.Exit(1)
End Try
'now lets make sure the two users match, also convert the strings to uppercase just incase
'the user logs on as Username then username
If useraweekago.ToUpper = username.ToUpper Then
Try
Dim conn As New SqlClient.SqlConnection("Data Source=glasms;" + "Initial Catalog=SMS_GLA;" + "User ID=******;" + "Password=*******;")
Dim cmd As New SqlClient.SqlCommand
cmd.CommandTimeout = 60
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "select isd.productcode00 from dbo.installed_software_data isd join system_data SYS on sys.machineID = ISD.machineID where arpdisplayname00 like '%adobe%standard%' and isd.productcode00 like '{%}' and name0 = '" & compname & "'"
conn.Open()
uniqueid = (cmd.ExecuteScalar)
conn.Close()
Catch ex As Exception
System.Environment.Exit(1)
End Try
'-------------------------------------------------------------------------------------'
Dim filename As String
Dim arguments As String
Dim processname As String
filename = "msiexec"
arguments = "/x " & uniqueid & " /qn /norestart"
processname = "acrobat"
'--------------------------------------------------------------------------------'
'in the unlikely event adobe standard is uninstalled before sccm executes this exe
'lets just do a check its still on the machine
Dim path As String = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & uniqueid & ""
If My.Computer.Registry.GetValue(path, "DisplayName", Nothing) Is Nothing Then
System.Environment.Exit(1)
Else
If Process.GetProcessesByName(processname).Length < 1 Then
'is closed
Dim client As New Process
client.StartInfo.FileName = filename
client.StartInfo.Arguments = arguments
client.Start()
client.WaitForExit(600000)
If client.HasExited = False Then
strbody = "<BR><font size=4 face=arial color=red><b>Uninstall Failed</font><BR><BR><font size=2 face=arial color=black>" & Application & " uninstall has failed for the following user on the following computer: <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON: Uninstall process ran for longer than 10 minutes</b></font>"
client.Kill()
client.WaitForExit()
message.Body = strbody
mail.Send(message)
System.Environment.Exit(1)
End If
If client.ExitCode = "0" Then
strbody = "<BR><font size=4 face=arial color=green><b>Uninstall Successful</font><BR><BR><font size=2 face=arial color=black>" & Application & " has been successfully uninstalled for the following user on the following computer: <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON: This was a result of the user not being in the " & SCCMAllow & " Group in Active Directory</b></font>"
message.Body = strbody
mail.Send(message)
System.Environment.Exit(0)
End If
If client.ExitCode <> "0" Then
strbody = "<BR><font size=4 face=arial color=red><b>Uninstall Failed</font><BR><BR><font size=2 face=arial color=black>" & Application & " has failed to uninstall for the following user on the following computer: <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON: Uninstall returned an error code of " & client.ExitCode & ".</b></font>"
message.Body = strbody
mail.Send(message)
System.Environment.Exit(1)
End If
Else
'is open
Dim strbody1 As String
strbody1 = "<BR><font size=4 face=arial color=red><b>Uninstall Failed</font><BR><BR><font size=2 face=arial color=black>Attempt to uninstall " & Application & " aborted for the following user on the following computer : <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON : The process " & processname & " was running</b></font>"
message.Body = strbody1
mail.Send(message)
System.Environment.Exit(1)
End If
End If
Else
Dim strbody2 As String
strbody2 = "<BR><font size=4 face=arial color=red><b>Uninstall Failed</font><BR><BR><font size=2 face=arial color=black>Attempt to uninstall " & Application & " aborted for the following user on the following computer : <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON : The current user (" & username & ") does not match the user (" & useraweekago & ") logged on a week ago.</b></font>"
message.Body = strbody2
mail.Send(message)
System.Environment.Exit(1)
End If
End Sub
End Module
Module Module1
Sub Main()
Dim uniqueid As String = String.Empty
Dim compname As String = My.Computer.Name
Dim useraweekago As String = String.Empty
Dim fullusername As String = String.Empty
My.User.InitializeWithWindowsUser()
Dim username As String = Replace(My.User.Name, "yourdomain\", "")
Dim Application As String
Dim SCCMAllow As String
Application = "Adobe Standard"
SCCMAllow = "SCCM - Allow Adobe Standard"
Dim mail As New System.Net.Mail.SmtpClient("123.123.123.123")
Dim address As New System.Net.Mail.MailAddress("donotreply@yourdomain.com")
Dim toAddress As New System.Net.Mail.MailAddress("youraddress@yourdomain.com")
Dim message As New System.Net.Mail.MailMessage(address, toAddress)
Dim strsubject As String
Dim strbody As String
strsubject = "SCCM Application Uninstall - " & Application & ""
message.IsBodyHtml = True
message.Subject = strsubject
Try
Dim conn As New SqlClient.SqlConnection("Data Source=glasms;" + "Initial Catalog=SMS_GLA;" + "User ID=******;" + "Password=*******;")
Dim cmd As New SqlClient.SqlCommand
cmd.CommandTimeout = 60
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "select full_user_name0 from user_disc where user_name0 = '" & username & "'"
conn.Open()
fullusername = (cmd.ExecuteScalar)
conn.Close()
Catch ex As Exception
System.Environment.Exit(1)
End Try
'first off because its adobe standard and lots of secretarys have it on desktops that can be used
'by visiting people, we are going to query the sms database to find out who was logged on 7 days
'ago. if the initialized user doesnt match we will abort the uninstall.
Try
Dim conn As New SqlClient.SqlConnection("Data Source=glasms;" + "Initial Catalog=SMS_GLA;" + "User ID=*****;" + "Password=*******;")
Dim cmd As New SqlClient.SqlCommand
cmd.CommandTimeout = 60
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "select replace(name00,'yourdomain\',') from network_login_profile_hist osd join system_data sys on sys.machineid = osd.machineid where osd.fullname00 is not null and lastlogon00 < (getdate() - 7) and sys.name0 = '" & compname & "' order by lastlogon00 desc"
conn.Open()
useraweekago = (cmd.ExecuteScalar)
conn.Close()
Catch ex As Exception
System.Environment.Exit(1)
End Try
'now lets make sure the two users match, also convert the strings to uppercase just incase
'the user logs on as Username then username
If useraweekago.ToUpper = username.ToUpper Then
Try
Dim conn As New SqlClient.SqlConnection("Data Source=glasms;" + "Initial Catalog=SMS_GLA;" + "User ID=******;" + "Password=*******;")
Dim cmd As New SqlClient.SqlCommand
cmd.CommandTimeout = 60
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "select isd.productcode00 from dbo.installed_software_data isd join system_data SYS on sys.machineID = ISD.machineID where arpdisplayname00 like '%adobe%standard%' and isd.productcode00 like '{%}' and name0 = '" & compname & "'"
conn.Open()
uniqueid = (cmd.ExecuteScalar)
conn.Close()
Catch ex As Exception
System.Environment.Exit(1)
End Try
'-------------------------------------------------------------------------------------'
Dim filename As String
Dim arguments As String
Dim processname As String
filename = "msiexec"
arguments = "/x " & uniqueid & " /qn /norestart"
processname = "acrobat"
'--------------------------------------------------------------------------------'
'in the unlikely event adobe standard is uninstalled before sccm executes this exe
'lets just do a check its still on the machine
Dim path As String = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & uniqueid & ""
If My.Computer.Registry.GetValue(path, "DisplayName", Nothing) Is Nothing Then
System.Environment.Exit(1)
Else
If Process.GetProcessesByName(processname).Length < 1 Then
'is closed
Dim client As New Process
client.StartInfo.FileName = filename
client.StartInfo.Arguments = arguments
client.Start()
client.WaitForExit(600000)
If client.HasExited = False Then
strbody = "<BR><font size=4 face=arial color=red><b>Uninstall Failed</font><BR><BR><font size=2 face=arial color=black>" & Application & " uninstall has failed for the following user on the following computer: <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON: Uninstall process ran for longer than 10 minutes</b></font>"
client.Kill()
client.WaitForExit()
message.Body = strbody
mail.Send(message)
System.Environment.Exit(1)
End If
If client.ExitCode = "0" Then
strbody = "<BR><font size=4 face=arial color=green><b>Uninstall Successful</font><BR><BR><font size=2 face=arial color=black>" & Application & " has been successfully uninstalled for the following user on the following computer: <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON: This was a result of the user not being in the " & SCCMAllow & " Group in Active Directory</b></font>"
message.Body = strbody
mail.Send(message)
System.Environment.Exit(0)
End If
If client.ExitCode <> "0" Then
strbody = "<BR><font size=4 face=arial color=red><b>Uninstall Failed</font><BR><BR><font size=2 face=arial color=black>" & Application & " has failed to uninstall for the following user on the following computer: <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON: Uninstall returned an error code of " & client.ExitCode & ".</b></font>"
message.Body = strbody
mail.Send(message)
System.Environment.Exit(1)
End If
Else
'is open
Dim strbody1 As String
strbody1 = "<BR><font size=4 face=arial color=red><b>Uninstall Failed</font><BR><BR><font size=2 face=arial color=black>Attempt to uninstall " & Application & " aborted for the following user on the following computer : <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON : The process " & processname & " was running</b></font>"
message.Body = strbody1
mail.Send(message)
System.Environment.Exit(1)
End If
End If
Else
Dim strbody2 As String
strbody2 = "<BR><font size=4 face=arial color=red><b>Uninstall Failed</font><BR><BR><font size=2 face=arial color=black>Attempt to uninstall " & Application & " aborted for the following user on the following computer : <BR><BR>" & fullusername & "<BR>" & compname & "<BR><BR>REASON : The current user (" & username & ") does not match the user (" & useraweekago & ") logged on a week ago.</b></font>"
message.Body = strbody2
mail.Send(message)
System.Environment.Exit(1)
End If
End Sub
End Module
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.