Cleanup Office after setup

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.
But to do it silently?
 
FYI, you can place ODT setup.exe and configuration.xml (must be named like that) inside Office folder, and install it with just: setup.exe /configure
without specifying config path or SourcePath in the config, it will be auto-detected
 
Code:
@echo off
powershell -nop Add-Type -MemberDefinition '[DllImport(""""User32.dll"""")]public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);' -Namespace Win32 -Name Functions; [Win32.Functions]::ShowWindow(((Get-Process -Id (gwmi Win32_Process -Filter "ProcessId=$PID").ParentProcessId)).MainWindowHandle,0)

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
 
Back
Top