Maciej
Maciej

Reputation: 1519

How to uninstall AWSPowerShell/AWS.Tools module from Powershell?

First steps in Powershell. I can not remove / uninstall AWSPowerShell module from AWS installed modules. Get-Module -Name AWSPowerShell,AWSPowerShell.NetCore,AWS.Tools.Common -ListAvailable showing as follows:

    Directory: C:\Users\user\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Binary     4.1.14.0              AWS.Tools.Common                    Core,Desk {Clear-AWSHistory, Set-AWSHistoryConfiguration, Initialize-AWSDefaultConfi…

    Directory: C:\Program Files (x86)\AWS Tools\PowerShell

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Binary     3.3.509.0             AWSPowerShell                       Desk

Whem I'm trying to uninstall it via Uninstall-Module -Name AWSPowerShell I'm getting error:

    Uninstall-Package: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:12733
 Line |
12733 |  …        $null = PackageManagement\Uninstall-Package @PSBoundParameters
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      | No match was found for the specified search criteria and module names 'AWSPowerShell'.

Question - how can i get rid of this one?

Upvotes: 4

Views: 7290

Answers (2)

Murow
Murow

Reputation: 11

In order to Install the AWSPowerShell Module you need to place the folder inside

C:\Program Files\WindowsPowerShell\Modules

after that you can execute the following command to install the module:

Import-Module AWSPowerShell 

Now AWSPowerShell should be installed on the client.

If you want to remove AWSPowerShell you need to execute the following command:

Remove-Module AWSPowerShell

Once the module is removed you can delete the folder:

C:\Program Files\WindowsPowerShell\Modules\AWSPowerShell

More information on those commands can be found in the Microsoft Wiki:

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/import-module?view=powershell-7.2

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/remove-module?view=powershell-7.2

Upvotes: 0

Mickey Cohen
Mickey Cohen

Reputation: 1277

You need to simply delete it. If you want to do it via PowerShell, you can do something like this:

Get-Module -Name <ModuleName> -ListAvailable | Select-Object -ExpandProperty ModuleBase | Remove-Item -Recurse -Force

Upvotes: 10

Related Questions