Skip to content

Powershell Preview Didn't Properly Uninstall #12105

Closed

Description

I uninstalled PowerShell Preview via the control panel.

However it seems to not have uninstalled properly.

image

As you can see powershell preview is still there when I right click.

Any advice how to get rid of this and/or prevent this issue?

Activity

  1. ghost added
    Issue-Question
    on Mar 11, 2020
  2. mklement0 commented on Mar 11, 2020

    @mklement0
    Contributor

    Don't know what caused it or how to prevent it (see Heath Stewart (@heaths)' comment below), but you can remove the context-menu entries as follows (update: now perform a search for all relevant keys):

    # MUST BE RUN FROM AN ELEVATED CONSOLE.
    
    # Target version whose context menus to remove.
    # Use the version suffix as it appears in the shortcut menus,
    # and append the bitness of the installation ('x64' vs. 'x86' (32-bit))
    $version = '7-previewx64'
    
    # Find all relevant key paths.
    $keyPaths = @(
        reg query HKEY_CLASSES_ROOT  /s /k /e /f "PowerShell$version" |
          Select-Object -SkipLast 1
      ) -ne '' -replace '^', 'registry::'
    
    Remove-Item -Recurse $keyPaths -WhatIf

    -WhatIf previews what would get deleted; remove it once you're confident the right keys are being targeted.

  3. MaximoTrinidad commented on Mar 12, 2020

    @MaximoTrinidad

    @YMba9g8j9CJp0wLoQf5y

    Please provide the system environment information, as this is very helpful!

    Now that PowerShell 7 is GA, there's no need to install back the any of the PowerShell 7 RC's.
    The next Preview coming out is PowerShell 7.1 which, I think will be coming soon.

    Better off doing a uninstall of the PowerShell Preview and everything should be OK.

  4. mklement0 commented on Mar 12, 2020

    @mklement0
    Contributor

    Maximo Trinidad (@MaximoTrinidad), note the premise of this issue:

    I uninstalled PowerShell Preview via the control panel.
    However it seems to not have uninstalled properly.

  5. MaximoTrinidad commented on Mar 12, 2020

    @MaximoTrinidad

    Michael Klement (@mklement0)

    I keep forgetting to mention that I manually clean up any left-over folders after the uninstall process. It seems to work for me.
    :)

  6. added
    WG-Maintainers-Build
    on Mar 12, 2020
  7. iSazonov commented on Mar 12, 2020

    @iSazonov
    Collaborator
  8. heaths commented on Mar 12, 2020

    @heaths
    Contributor

    Right-click on it and go to the shortcut location, if you even get the option. If not, it's a visual cache issue that sometimes happen with Windows. Or did you by chance create this shortcut yourself, or customize console host setings (font, buffer size, etc.)? That will also create a user shortcut (replaces .pif files from old that will not be cleaned up (no way for Windows Installer to track it).

  9. mklement0 commented on Mar 12, 2020

    @mklement0
    Contributor

    Heath Stewart (@heaths), I think you're thinking about a taskbar icon's context menu, whereas @YMba9g8j9CJp0wLoQf5y is talking about a File Explorer / Desktop folder's shortcut menu.

    @YMba9g8j9CJp0wLoQf5y, can you confirm?

  10. mklement0 commented on Mar 12, 2020

    @mklement0
    Contributor

    Yes, that's what I meant - these entries there are controlled via registry entries, not shortcut files, hence my manual removal commands above.

  11. heaths commented on Mar 12, 2020

    @heaths
    Contributor

    Okay. Likely because the component GUIDs were changed. This affects ref-counting components. I'll be rescheduling RemoveExistingProducts which will fix a lot of these issues as well. (Generally, don't hardcode component GUIDs unless you have to with WiX 3.10 and newer.)

  12. MaximoTrinidad commented on Mar 12, 2020

    @MaximoTrinidad

    Cool!

    I was able to reproduce the issue on a clean VM.

    Install PowerShell-7.0.0-rc.3-win-x64.msi
    Install PowerShell-7.0.0-win-x64.msi
    

    All short-cuts icons show up fine.

    Uninstall from Control Panel: PowerShell-7.0.0-rc.3
    ** Follow by a system restart **
    

    The PowerShell Preview shortcut is not removed.

    Now I understand the work-around, to remove manually the entries from the registry:
    manual removal commands

    Here's the image of the registry after the uninstall of the PowerShell Preview:

    PS7Prev_01_2020-03-12_19-19-44

    PS7Prev_03_2020-03-12_19-31-52

    Now, If I run the installation of PowerShell Preview again, I get back the shortcut to work.

    PS7Prev_02_2020-03-12_19-31-52

    Thanks, Michael Klement (@mklement0)

  13. 20 remaining items

  14. mklement0 commented on Mar 20, 2020

    @mklement0
    Contributor

    @YMba9g8j9CJp0wLoQf5y, and the following produces no output?

    reg query HKEY_CLASSES_ROOT /s /k /e /f "PowerShell7-previewx64"

  15. mklement0 commented on Mar 20, 2020

    @mklement0
    Contributor

    @YMba9g8j9CJp0wLoQf5y:

    If you can't run this command, you couldn't possibly have successfully removed the keys with the removal commands, given that that command is part of the latter.

    Make sure that you run the commands as an administrator.

    And, generally, please be more specific up-front about what actually happened when you say things like "I just tried the new removal command" and things didn't work as expected.

  16. mklement0 commented on Mar 20, 2020

    @mklement0
    Contributor

    If you're at least able to run Remove-Item as admin, then try to use the following, explicit list of key paths (obtained with the reg query command):

    $keyPaths =
      'registry::HKEY_CLASSES_ROOT\DesktopBackground\Shell\PowerShell7-previewx64',
      'registry::HKEY_CLASSES_ROOT\Directory\Background\shell\PowerShell7-previewx64',
      'registry::HKEY_CLASSES_ROOT\Directory\ContextMenus\PowerShell7-previewx64',
      'registry::HKEY_CLASSES_ROOT\Directory\shell\PowerShell7-previewx64',
      'registry::HKEY_CLASSES_ROOT\Drive\shell\PowerShell7-previewx64',
      'registry::HKEY_CLASSES_ROOT\LibraryFolder\background\shell\PowerShell7-previewx64'
  17. mklement0 commented on Mar 20, 2020

    @mklement0
    Contributor

    @YMba9g8j9CJp0wLoQf5y, sorry - had forgotten the registry:: provider prefix - please see the since-updated previous comment.

  18. iSazonov commented on Mar 20, 2020

    @iSazonov
    Collaborator

    We will get updated MSI in next month.

  19. ghost closed this as completedon Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-QuestionResolution-AnsweredWG-Maintainers-Build

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions