71 views +1 -0

Repair Office from command line

Full repair oneliner:

powershell -NoProfile -ExecutionPolicy Bypass -Command "$p = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration' -ErrorAction Stop; Start-Process 'C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe' -ArgumentList ('scenario=Repair platform=' + $p.Platform + ' culture=' + $p.ClientCulture + ' RepairType=FullRepair DisplayLevel=False forceappshutdown=true')"

Quick repair:

"C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe" scenario=Repair platform=x64 culture=nl-nl RepairType=QuickRepair DisplayLevel=False

Online repair:

"C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe" scenario=Repair platform=x64 culture=nl-nl RepairType=FullRepair DisplayLevel=False

PowerShell met auto-detectie:

$cfg = 'HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration'
$p = Get-ItemProperty $cfg -ErrorAction Stop
$exe = 'C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe'
$repairArgs = "scenario=Repair platform=$($p.Platform) culture=$($p.ClientCulture) RepairType=QuickRepair DisplayLevel=False forceappshutdown=true"
Start-Process $exe -ArgumentList $repairArgs