Uninstall Office 2013 and install Office 365 Powershell

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Brian Petersen Brian Petersen 2 years, 1 month ago.

  • Author
    Posts
  • #19942
    Profile photo of Brian Petersen
    Brian Petersen
    Participant

    Hi,

    I need the following powershell script and i cant figure out how to make this.

    ———— pseudo powershell code ———-

    Tjeck for office 2013 installation.

    IF Office 2013 is installed, remove Office 2013 and Install/upgrade to Office 366

    ELSE run Office 365 Quickrepair with finish dialog "Repair done"

    End of script

    ——————————————————————

    Can someone help me with this?

    Best regards

    Brian Petersen

  • #19945
    Profile photo of Ondrej Zilinec
    Ondrej Zilinec
    Participant

    IMHO you should yourself 🙂 This is not cookbook forum 🙂

    [ul]To check if app is installed I would use [b]Get-WmiObject -Class Win32_Product[/b][/ul]
    [ul]To uninstall app I would get MSI GUID from first command and run [/b][/ul]
    [ul]To install app I would use quiet installation method of app [/b][/ul]

    Have a look [url=http://blogs.technet.com/b/heyscriptingguy/archive/2011/11/13/use-powershell-to-quickly-find-installed-software.aspx]here[/url] and [url=http://blogs.technet.com/b/heyscriptingguy/archive/2013/11/15/use-powershell-to-find-installed-software.aspx]here[/url].

  • #19948
    Profile photo of Brian Petersen
    Brian Petersen
    Participant

    Hi, yes i know and i should have wrote, that i am indeed trying.
    I am working on a powershell script now, but have run into the first problem.

    I want to run a windows troubleshooter file (.diagcab) SILENT, from a powershell script. This file uninstalles ALL office instances on a client.
    I manage to read that you have to make a answerfile to make it silent but im stuck here. :o/

  • #19952
    Profile photo of Alexander Johansson
    Alexander Johansson
    Participant

    Could you give an example from your script on how you are running the troubleshooting pack?

    This is stated in the help file for "Get-TroubleshootingPack":

    Example 4: Generate an answer file

    Get-TroubleshootingPack -Path "C:\Windows\Diagnostics\System\Audio" -AnswerFile "AudioAnswerFile.xml"

    This command uses the Get-TroubleshootingPack cmdlet to generate an answer file. The Areo troubleshooting pack provides
    a series of questions for the user to describe the troubleshooting situation and saves that information in the specified XML file.

    This is stated in the help file for "Invoke-TroubleshootingPack":

    Example 3: Run a troubleshooting pack in unattended mode

    $Audio = Get-TroubleshootingPack -Path "C:\Windows\Diagnostics\System\Audio"
    Invoke-TroubleshootingPack -Pack $Audio -AnswerFile "AudioAnswerFile.xml" -Unattended

    This example runs the Audio pack in unattended mode with a specified answer file.

    The first command uses the Get-TroubleshootingPack cmdlet to get a DiagPack object and stores it in the $Audio variable.

    The second command invokes the troubleshooting pack stored in $Audio in unattended mode. The command specifies an answer
    file, previously created by using the Get-TroubleshootingPack cmdlet.

    I can't test this on your specific diagcab but you could try to run the first example I showed you and then the second one, with your specific paths of course.

    /Alexander

  • #19995
    Profile photo of Brian Petersen
    Brian Petersen
    Participant

    Thx,

    I managed to do it with your help.

You must be logged in to reply to this topic.