The procedure below will remove an existing Adobe Acrobat Reader DC installation and will install Adobe Acrobat Reader DC along with its latest patch. The same procedure can be used for any other software.
Prerequisites:
The steps that need to be followed (in brief) are shown below:
1. Identify the GUID of the software to be removed with the use of a PowerShell command
2. Identify the Process (name and/or ID) of the running instance of the software on the remote computer.
3. Create the batch file which will:
a) Use PsKill (part of PsTools) to remotely kill any process of the s/w that is running on the target PC prior the removal
b) Use PsExec (part of PsTools) to remotely remove the software based on its GUID
c) Use PsExec to remotely install the new software from a network share at the source PC executing the batch file from.
d) Use PsExec to remotely install the latest patch of the software
Step 1:
Use PowerShell to identify the GUID of the actual software that you want to remove.
Command:
get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name -AutoSize
Result:
As shown in the results of the PS command, Adobe Acrobat Reader DC has the following GUID: {AC76BA86-7AD7-1033-7B44-AC0F074E4100}
P.S. More on decoding the Adobe Acrobat Reader GUID can be found in the following article: Identifying Existing Installs
Step 2:
As we need to run the removal command with the s/w closed at the remote computer, we need first to close any instance of the s/w running. To kill the relevant processes we need to identify them first. By running the below command we will be able to identify if there is any process running at the remote PC starting with "Acro"
Command:
pslist \\remotePCname -u uname -p pwd Acro
Result:
Step 3:
At this step, we will build the batch file that will perform 4 consecutive actions as described above.
a. Kill any running instance of Acrobat Reader on the remote PC based on the Process name as found in step 2 above.
Command:
pskill -t \\remotePCname -u uname -p pwd AcroRd32
Result:
b. Remove the installed version of the software based on its GUID
Command:
psexec \\remotePCname -u uname -p pwd cmd /c "msiexec.exe /x {AC76BA86-7AD7-1033-7B44-AC0F074E4100} /quiet /norestart"
Result:
Successful execution should result in "error code 0"
c. Install the new software
Command:
psexec \\remotePCname -u uname -p pwd cmd /c "msiexec.exe /i "\\sourcePCname\share\AcroRead.msi" /quiet /norestart"
Result:
Successful execution should result in "error code 0"
d. Install latest patch of the new software
Command:
psexec \\remotePCname -u uname -p pwd cmd /c "msiexec.exe /p "\\sourcePCname\share\AcroRdrDCUpd1900820081.msp" /quiet /norestart"
Result:
Successful execution should result in "error code 0"
The complete batch file would look like this:
pskill -t \\remotePCname -u uname -p pwd AcroRd32
psexec \\remotePCname -u uname -p pwd cmd /c "msiexec.exe /x {AC76BA86-7AD7-1033-7B44-AC0F074E4100} /quiet /norestart"
psexec \\remotePCname -u uname -p pwd cmd /c "msiexec.exe /i "\\sourcePCname\share\AcroRead.msi" /quiet /norestart"
psexec \\remotePCname -u uname -p pwd cmd /c "msiexec.exe /p "\\sourcePCname\share\AcroRdrDCUpd1900820081.msp" /quiet /norestart"
In case the above should be executed towards a batch of computers you can edit your batch file adding a loop towards the content of a file named computers.txt in which each line will include the name of each of the remote computers.
e.g. Create a file named computers.txt. Place the name of the remote PCs one per line as per example the example shown below. Save the file in the same folder with the batch file.
remotePCname1
remotePCname2
remotePCname3
.
.
.
remotePCnameN
The batch file should be like the following:
for /F %%i in (computers.txt) do (
pskill -t \\%%i -u uname -p pwd AcroRd32
psexec \\%%i -u uname -p pwd cmd /c "msiexec.exe /x {AC76BA86-7AD7-1033-7B44-AC0F074E4100} /quiet /norestart"
psexec \\%%i -u uname -p pwd cmd /c "msiexec.exe /i "\\sourcePCname\share\AcroRead.msi" /quiet /norestart"
psexec \\%%i -u uname -p pwd cmd /c "msiexec.exe /p "\\sourcePCname\share\AcroRdrDCUpd1900820081.msp" /quiet /norestart"
)
Notes:
Hope you enjoy it and you found it helpful.
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)