On Windows operating systems, PowerShell is a flexible scripting language that enables users to automate a variety of operations. One of its useful features is “PowerShellGet”, a module management tool that enables users to install, update, and uninstall PowerShell modules. This article aims to explore the “Uninstall-Module” command within PowerShellGet, highlighting its functionalities and importance in the context of module management.

Brief Overview of “PowerShellGet”

“PowerShellGet” is a module integrated into PowerShell that simplifies the installation and management of modules, scripts, and packages for the Windows PowerShell environment. It provides a standardized mechanism to discover, install, update, and remove modules from centralized repositories such as the PowerShell Gallery.

Uninstall a Module

Uninstall-Module” is a key command within PowerShellGet that allows users to remove the installed modules from their system.


The syntax for “Uninstall-Module” is straightforward, typically requiring “-Name” for the name of the module to be uninstalled as its primary parameter, as follows:

         [-Name] <String[]>
         [-MinimumVersion <String>]
         [-RequiredVersion <String>]
         [-MaximumVersion <String>]


In this syntax, the optional parameters can be used to control the behavior of the command, such as the following:

Parameter Description
MinimumVersion It determines the oldest version of the module to be removed. It is not possible to use both the MinimumVersion and RequiredVersion parameters in the same command.
RequiredVersion It supports version-specific module removal, allowing users to uninstall a particular module version while keeping other versions intact.
MaximumVersion This parameter determines the most recent or newest version of the module to be removed. It is not possible to use both the MaximumVersion and RequiredVersion parameters in the same command.
AllVersions Users can remove all versions of a particular module that are currently available. This parameter cannot be used with MinimumVersion, MaximumVersion, or RequiredVersion parameters.
Force This parameter allows users to bypass dependency checks and forcibly remove the module.
AllowPrerelease It allows users to uninstall a pre-release module.
WhatIf It tells the consequences of the uninstall command.
Confirm It asks you for confirmation before the uninstalling process.


Note: The “Uninstall-Module” command follows the principle of invoking the desired module’s uninstall script, if available, to clean up its installation artifacts.

Module Removal Process

When invoked, “Uninstall-Module” initiates a series of actions to remove a module from the system. Firstly, it validates the specified module’s existence, ensuring that it is present and accessible. One thing to keep in mind is that by default, it removes locally installed modules.

Upon confirmation, the command identifies and executes the module’s designated uninstall script, which should execute the necessary actions to remove any files, registry entries, or other resources associated with the module.

Let’s suppose we want to uninstall a module named “NetworkingDsc” from the system via PowerShell. To do so, apply the below-stated command:

Uninstall-Module -Name NetworkingDsc


Suppose now we want to uninstall all the available versions of the “NetworkingDsc” module via PowerShell, utilize the following command:

Uninstall-Module -Name NetworkingDsc -AllVersions


It’s important to note that the module name is case-insensitive.

Multiple Modules Uninstallation

In addition to “uninstalling individual modules”, the “Uninstall-Module” command also supports multiple uninstallations. This cmdlet accepts an array of module names using the “-Name” parameter, allowing you to uninstall multiple modules simultaneously. Here’s an example:

$modules = "NetworkingDsc", "NTFSSecurity"
Uninstall-Module -Name $modules


The above “Uninstall-Module” cmdlet uninstalls “NetworkingDsc” and “NTFSSecurity” from the system.

Handling Dependencies

“Uninstall-Module” optimizes the module removal process by automatically detecting and handling dependencies. If other modules rely on the module being uninstalled, PowerShellGet checks for dependent modules’ presence and prompts the user to decide whether to uninstall them as well or cancel the uninstallation.

Integration with PowerShell Ecosystem

“Uninstall-Module” seamlessly integrates with other PowerShell commands, allowing users to combine it with scripting capabilities to automate module uninstallation tasks. Through PowerShell’s scripting language, users can develop scripts that iterate through a list of modules to be removed from multiple systems simultaneously, vastly enhancing the efficiency and scalability of module management operations.


Uninstall-Module” plays a pivotal role within “PowerShellGet”, providing an intuitive and efficient solution for uninstalling PowerShell modules. From managing dependencies to version-specific removal, the command grants users control and flexibility in module management, ensuring system integrity while simplifying the cleanup process.

About the author

Hiba Shafqat

I am a Computer Science student and a committed technical writer by choice. It is a great pleasure to share my knowledge with the world in which I have academic expertise.