• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    Powershell or Batch To uninstall

    Opera for Windows
    2
    3
    3025
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jmason
      jmason last edited by leocg

      Hello Everyone

      Somehow our tool pushed out Opera Stable 99.0.4788.13. I am unable to create a powershell script or a batch file to do a silient uninstall. I was able to get a batch file the calls the uninstall but it still require user input to select uninstall.

      @echo off
      taskkill /IM opera.exe /F
      taskkill /IM opera_autoupdate.exe /F
      taskkill /IM opera_crashreporter.exe /F
      taskkill /IM opera_gpu_launcher.exe /F
      taskkill /IM opera_plugin_wrapper.exe /F
      taskkill /IM opera_stable.exe /F
      taskkill /IM opera_updater.exe /F
      start /wait "" "%PROGRAMFILES(x86)%\Opera\launcher.exe" --uninstall --deleteuserprofile=1 
      rd /s /q "%PROGRAMFILES%\Opera"
      rd /s /q "%APPDATA%\Opera Software"
      rd /s /q "%LOCALAPPDATA%\Opera Software"
      

      Any help would be appreciated.

      Reply Quote 0
        1 Reply Last reply
      • burnout426
        burnout426 Volunteer last edited by

        See https://forums.opera.com/post/266906. The silent uninstall switch was purposely disabled by Opera. It's also noted at the bottom of https://www.reddit.com/r/operabrowser/wiki/opera/installer_commands/ that it's no longer supported.

        Reply Quote 0
          1 Reply Last reply
        • jmason
          jmason last edited by leocg

          Working Powershell Script to do a slient install

          [CmdletBinding()]
          param (
            [Parameter()]
            [switch]$DeleteUserProfile,
            [Parameter()]
            [String]$installDirectory
          )
          
          begin {
            function Test-IsSystem {
              $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
              return $id.Name -like "NT AUTHORITY*" -or $id.IsSystem
            }
          }
          process {
            if (-not (Test-IsSystem)) {
              Write-Error -Message "This script needs to run as System (in order to hide the gui)."
              exit 1
            }
          
            $PotentialInstallLocations = New-Object System.Collections.Generic.List[Object]
          
          
            $ProgramFiles = Get-ChildItem $env:ProgramFiles -ErrorAction SilentlyContinue | Where-Object { $_.PSIsContainer -eq $true -and $_.Name -like "*Opera*" } | Select-Object Fullname
            if ($ProgramFiles) { $ProgramFiles | ForEach-Object { $PotentialInstallLocations.Add($_) } }
          
            $ProgramFilesX86 = Get-ChildItem ${env:ProgramFiles(x86)} -ErrorAction SilentlyContinue | Where-Object { $_.PSIsContainer -eq $true -and $_.Name -like "*Opera*" } | Select-Object Fullname
            if ($ProgramFilesX86) { $ProgramFilesX86 | ForEach-Object { $PotentialInstallLocations.Add($_) } }
          
            $AppData = Get-ChildItem C:\Users\*\AppData\Local\Programs -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.PSIsContainer -eq $true -and $_.Name -like "*Opera*" } | Select-Object Fullname
            if ($AppData) { $AppData | ForEach-Object { $PotentialInstallLocations.Add($_) } }
          
            if ($installDirectory) {
              $Directory = Get-Item $installDirectory -ErrorAction SilentlyContinue
              if ($Directory) { $PotentialInstallLocations.Add($Directory) }
            }
          
            if ($PotentialInstallLocations) {
              $OperaExe = $PotentialInstallLocations | ForEach-Object { Get-ChildItem $_.FullName | Where-Object { $_.Name -like "opera.exe" } }
              $LauncherExe = $OperaExe | ForEach-Object { "$($_.Directory)\launcher.exe" | Where-Object { Test-Path $_ -ErrorAction SilentlyContinue } }
            }
            
            if ($LauncherExe) {
          
              Write-Host "Opera installations found! Below are the install locations."
              $LauncherExe | Write-Host
          
              # Killing All Opera Processes
              Write-Warning "Killing all Opera Processes for uninstall."
              Get-Process "opera" -ErrorAction SilentlyContinue | Stop-Process -Force
              Get-Process "OperaSetup" -ErrorAction SilentlyContinue | Stop-Process -Force
          
              if ($DeleteUserProfile) {
                Write-Warning "Delete User Browser Profile Selected!"
                $Arguments = "--uninstall", "--runimmediately", "--deleteuserprofile=1"
              }
              else {
                $Arguments = "--uninstall", "--runimmediately", "--deleteuserprofile=0"
              }
          
              $Process = $LauncherExe | ForEach-Object {
                Start-Process -Wait $_ -ArgumentList $Arguments -PassThru 
              }
              Write-Host "Exit Code(s): $($Process.ExitCode)"
          
              $Process | ForEach-Object {
                switch ($_.ExitCode) {
                  0 { Write-Host "Opera removal Success! Please note that Opera will still be visible in the Control Panel however it won't prompt for admin to remove it from the control panel when clicking uninstall." }
                  default {
                    Write-Error "Exit code does not indicate success"
                    exit 1
                  }
                }
              }
          
              $TaskbarLocations = Get-ChildItem -Recurse "C:\Users\*\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" -ErrorAction SilentlyContinue | Where-Object { $_.Name -like "Opera Browser.lnk" } | Select-Object FullName
          
              if ($TaskbarLocations) {
                Write-Host "Cleaning up taskbar icons. Please note the taskbar icon will still be visible (though it won't prompt for admin to remove it from the taskbar)."
                Write-Host "### Taskbar Icon Locations ###"
                $TaskbarLocations.FullName | Write-Host
                $TaskbarLocations | ForEach-Object {
                  Remove-Item $_.FullName
                }
              }
              else {
                Write-Host "No Taskbar Icons found!"
              }
          
              $DesktopIcons = Get-ChildItem -Recurse "C:\Users\*\Desktop" -ErrorAction SilentlyContinue | Where-Object { $_.Name -like "Opera Browser.lnk" } | Select-Object FullName
          
              if ($DesktopIcons) {
                Write-Host "Cleaning up Desktop icons."
                Write-Host "### Desktop Icon Locations ###"
                $DesktopIcons.FullName | Write-Host
                $DesktopIcons | ForEach-Object {
                  Remove-Item $_.FullName
                }
              }
              else {
                Write-Host "No Desktop Icons found!"
              }
          
              $StartMenu = Get-ChildItem -Recurse "C:\Users\*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs" -ErrorAction SilentlyContinue | Where-Object { $_.Name -like "Opera Browser.lnk" } | Select-Object FullName
          
              if ($StartMenu) {
                Write-Host "Cleaning up Start Menu."
                Write-Host "### StartMenu Locations ###"
                $StartMenu.FullName | Write-Host
                $StartMenu | ForEach-Object {
                  Remove-Item $_.FullName
                }
              }
              else {
                Write-Host "No Start Menu Entries found!"
              }
          
            }
            else {
              Write-Error "No installations found in C:\Users\*\AppData\Local\Programs, C:\Program Files or C:\Program Files(x86). Maybe give an installation directory using -InstallDirectory 'C:\ReplaceMe' ?"
              Exit 1
            }
          }
          
          
          Reply Quote 1
            1 Reply Last reply
          • Locked by  leocg leocg 
          • First post
            Last post

          Computer browsers

          • Opera for Windows
          • Opera for Mac
          • Opera for Linux
          • Opera beta version
          • Opera USB

          Mobile browsers

          • Opera for Android
          • Opera Mini
          • Opera Touch
          • Opera for basic phones

          • Add-ons
          • Opera account
          • Wallpapers
          • Opera Ads

          • Help & support
          • Opera blogs
          • Opera forums
          • Dev.Opera

          • Security
          • Privacy
          • Cookies Policy
          • EULA
          • Terms of Service

          • About Opera
          • Press info
          • Jobs
          • Investors
          • Become a partner
          • Contact us

          Follow Opera

          • Opera - Facebook
          • Opera - Twitter
          • Opera - YouTube
          • Opera - LinkedIn
          • Opera - Instagram

          © Opera Software 1995-