Quantcast
Channel: Office 2013 and Office 365 ProPlus - Planning, Deployment, and Compatibility forum
Viewing all articles
Browse latest Browse all 3748

Uninstall Microsoft Office 2013 using Invoke-TroubleshootingPack

$
0
0
Hi,
I'm deploying an uninstallation package to uninstall Office 2013 using the ingenious Microsoft Fix it (located here: http://support.microsoft.com/kb/2739501/en-us) called O15CTRRemove.

When running it manually, it removes everything that is related to Microsoft Office 2013 and I am able to install a new Office 2013 without any problems (changing from Office 365 to VL).

The problem is as follows:
I need to do this silently on a lot of computers using a deployment tool. I figured out how to use powershell and I'm doing it in the following way:
Import-Module TroubleshootingPack
$DIAGOFFRemoveOff2013 = Get-TroubleshootingPack -Path "C:\Deployment\Office2013Uninstall\O15CTRRemove"
Invoke-TroubleshootingPack -Pack $DIAGOFFRemoveOff2013 -AnswerFile "C:\Deployment\Office2013Uninstall\DIAG_Off_RemoveOff2013.xml" -unattended
I created the Answerfile DIAG_Off_RemoveOff2013.xml in the following way (according tohttp://blogs.technet.com/b/heyscriptingguy/archive/2011/02/09/use-powershell-troubleshooting-packs-to-diagnose-remote-problems.aspx):
Get-TroubleshootingPack "C:\Deployment\Office2013Uninstall\O15CTRRemove" -answerfile "C:\Deployment\Office2013Uninstall\DIAG_Off_RemoveOff2013.xml"

It looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<Answers Version="1.0" />
When I run the script it works but for some reason, it doesn't work when I run it as system (my deployment tool runs the script as system, and I've tried it manually like this):
psexec -i -s cmd
cmd /C powershell -executionpolicy unrestricted -file "C:\Deployment\Office2013Uninstall\Uninstall_Office2013.ps1"
It just hangs and I can see in eventviewer that it has run a few troubleshooting packs, that the uninstall of Office is complete but it doesn't continue until I force kill sdiagnhost.exe.
If I run the script after killing sdiagnhost.exe, it finishes without a problem.
I have temporarily solved it like this (I run the same job twice, to be sure everything is removed and the second one finishes quickly while the first hangs until the timeout):
Start-Job -ArgumentList -ScriptBlock {
 $DIR = "C:\Deployment\Office2013Uninstall"
 Import-Module TroubleshootingPack

 $DIAGOFFRemoveOff2013 = Get-TroubleshootingPack -Path "${DIR}\O15CTRRemove"
 Invoke-TroubleshootingPack -Pack $DIAGOFFRemoveOff2013 -AnswerFile "${DIR}\DIAG_Off_RemoveOff2013.xml" -unattended
}

Get-Job | Wait-Job -Timeout 1200
Get-Job | Receive-Job
Get-Job | Remove-Job -Force

Start-Job -ArgumentList -ScriptBlock {
 $DIR = "C:\Deployment\Office2013Uninstall"
 Import-Module TroubleshootingPack

 $DIAGOFFRemoveOff2013 = Get-TroubleshootingPack -Path "${DIR}\O15CTRRemove"
 Invoke-TroubleshootingPack -Pack $DIAGOFFRemoveOff2013 -AnswerFile "${DIR}\DIAG_Off_RemoveOff2013.xml" -unattended
}

Get-Job | Wait-Job -Timeout 1200
Get-Job | Receive-Job
Get-Job | Remove-Job -Force
I am thinking that there is some kind of dialogue questions that I need to get into the answer file, but I have no idea how to do it.
Any help is appreciated!
Best regards,
Simon

Viewing all articles
Browse latest Browse all 3748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>