Forum Discussion

Jesse13579's avatar
Jesse13579
Copper Contributor
Sep 13, 2024

remove click to run with intune script

I'm trying to remove the en-us, es-es, and fr-fr versions of office clicktorun on my pcs to free up space and clean them up. I'm running this script via intune:

 

 

 

<# Sample Data: "scenario=install scenariosubtype=ARP sourcetype=None productstoremove=O365HomePremRetail.16_fr-fr_x-none culture=fr-fr DisplayLevel=False"

#>

 

$AllLanguages = "en-us", "es-es", "fr-fr"

$ClickToRunPath = "C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe" foreach($Language in $AllLanguages){ Start-Process $ClickToRunPath -ArgumentList "scenario=install scenariosubtype=ARP sourcetype=None productstoremove=O365HomePremRetail.16_$($Language)_x-none culture=$($Language) DisplayLevel=False" -Wait Start-Sleep -Seconds 5 }

 

 

 

But apparently I'm missing something and it's not uninstalling the programs. Has anyone done a similar thing or can spot where I messed up?

1 Reply

  • Jesse13579 

     

    Hi,

     

    I use the following script: 

     

    $OfficeUninstallStrings = ((Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*") | Where {$_.DisplayName -like "*Click-to-Run*"} |Select UninstallString).UninstallString
    
    ForEach ($UninstallString in $OfficeUninstallStrings){
    $UninstallCommand = (($UninstallString -split ' ')[1] -replace '/I','/X') + ' /q'` 
    Start-Process msiexec.exe -ArgumentList $UninstallCommand -Wait}

    ,

    Regards

     

Resources