Trying to Remove Office products smoothly with "Remove-PreviousOfficeInstalls" Powershell script
Hello,
I am fairly new to KACE scripting and I am trying to use the scripts located @https://github.com/OfficeDev/Office-IT-Pro-Deployment-Scripts/tree/master/Office-ProPlus-Deployment/Remove-PreviousOfficeInstalls,
to remove all versions of office and reinstall the latest version. However my scripting is not giving me the desired results. I am trying to upload a zipped file (Office365_Removal2) to c:\windows\temp, then from there I am tring to unzip that file which has multiple Office removal files and then run the powershell command to start the script to remove All-Office versions. I am uploading Unzipping from C:\Windows\Temp, because I haven't had results trying it from the $(KACE_DEPENENCY_DIR). Plus I haven't seen success trying to unzip the file from the $(KACE_DEPENDENCY_DIR) either.The files get downloaded to the (C:\ProgramData\Quest\KACE\kbots_cache\packages\kbots\177) directory but I haven't been able to work from there. Here is what I have so far. Looking for some assistance if possible if anyone has used these tools to remove Office in their environment.
-
I used the OCT and configured my 2019 install to remove all old versions. - SMal.tmcc 5 years ago
-
OCT will remove MSI installs of Office. They won't uninstall versions that used the click to run method. This is where you need the Office scrubber. - sfoxn64 5 years ago
Answers (2)
The Upload action attempts to upload a file from the client to the server, which I don't think is what you want to do. I'm pretty sure you want to get the zip file to the client, and that is done using a dependency. What are the contents of the zip file? When it is downloaded to the script's directory on the client, does it get automatically unzipped? What do those files look like? Are they all at the root of the dependency folder, or are they in a sub folder?
If the files get unzipped directly to the scripts folder, launching this command should work:
Directory: c:\windows\system32
Program: cmd.exe
Arguments: /c powershell.exe -ExecutionPolicy bypass -file $(KACE_DEPENDENCY_VARIABLE)\Remove-PreviousOfficeInstalls.ps1
Remember that when using cmd.exe to run a command you need to use the /c parameter.
In answer to chucksteels questions, contents of the files
Here are the contents ofthe .zip file below. It is basically all the OffScrub files and the .power shellscripts. They end up in the kbots->Script# Directory and it is unzippedthere into a subfolder.
I debate about zippingthem in a file or just adding them as dependencies, because I think they willgo to the same place as shown. But after I get them there that’s when I am notable to get the correct parameters to get the scripts to remove the previousversions of Office or even the current version.
Comments:
-
And what about the parameters you are using the launch the powershell script? - chucksteel 5 years ago
-
/c powershell.exe -ExecutionPolicy bypass -file $(KACE_DEPENDENCY_VARIABLE)\Office365_Removal\Remove-PreviousOfficeInstalls.ps1
But that is not working. - bowenz 5 years ago-
The variable is $(KACE_DEPENDENCY_DIR), not what you have there. - chucksteel 5 years ago
-
Why did you use cmd.exe for launch a powershell?
Directory: $(KACE_SYS_DIR)\WindowsPowerShell\v1.0
File: powershell.exe
Parameters: -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -File $(KACE_DEPENDENCY_DIR)\Yourscript.ps1 - Edenauto 5 years ago