How to uninstall Microsoft office 2016 by using Script.Pls help

Cuong Quach Duy 0 Reputation points
2024-12-21T16:00:18.1266667+00:00

Hi guy,

I need script to uninstall Microsoft office 2016 by MECM (Microsoft Endpoint Configuration Manager)

Thank for your help.

Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,800 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Marcin Policht 29,885 Reputation points MVP
    2024-12-21T17:56:11.3766667+00:00
    1. Prepare the uninstall command for Office 2016: You can use the setup.exe that was used for the original installation, or you can use a generic uninstall command. The command to uninstall Microsoft Office 2016 via the command line is as follows:
         "C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe" /update
      
    2. Create the script: You can use PowerShell - for example:
         # PowerShell script to uninstall Office 2016
         $OfficeC2RClient = "C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe"
         
         # Check if the OfficeC2RClient exists
         if (Test-Path $OfficeC2RClient) {
             # Uninstall Office 2016
             Start-Process -FilePath $OfficeC2RClient -ArgumentList "uninstall", "displaylevel=false", "forceappshutdown=true" -Wait
             Write-Host "Office 2016 has been uninstalled."
         } else {
             Write-Host "Office 2016 is not installed or the path is incorrect."
         }
      
    3. Deploy the script via MECM:
      • Step 1: Create a Package in MECM that contains the script (either PowerShell or batch file).
      • Step 2: Create a Program within the package to run the script (use the appropriate script file).
      • Step 3: Deploy the package to the target collection.
      • Step 4: Monitor the deployment status to ensure that Office 2016 is successfully uninstalled on the target machines.

    The path C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe may vary based on where Office 2016 was installed or if the user has a 32-bit or 64-bit version of Office. If Office was installed via the Microsoft Office Deployment Tool (ODT) or other methods, the uninstallation process may vary, and you'll need the specific uninstall command that matches how it was originally installed.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.