This is my method for installing Office, which avoids any cleanup work.
1. Copy this script as
RunOfficeSetup.bat and run from Post-Setup.
Code:
@echo off
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
if exist "%%i:\Office365_Deploy" (
set DRIVE=%%i
goto :INSTALL
)
)
:INSTALL
cd /d %DRIVE%:\Office365_Deploy && .\setup.exe /configure configuration-Office365-x64.xml
2. On your finished USB drive, copy the Office install folder to
\Office365_Deploy. Now the Post-Setup script searches all drives, until it finds the Office folder and begins installation. No more cleanup, because the folder stays on the USB drive and is never copied to your system.
Rename the folder or configuration XML to any name you want.