How to Check if a Module Is Installed using PowerShell?

In PowerShell, modules are the building blocks that extend its functionality. Whether you’re managing Azure, Active Directory, or automating Windows tasks, modules provide reusable commands and scripts that make your job easier.

But before using a module, you often need to check if it’s installed — especially when running scripts across multiple systems or CI/CD pipelines.

In this guide, you’ll learn every method to check if a PowerShell module is installed, how to list all installed modules, and how to troubleshoot missing or conflicting modules.

What Is a PowerShell Module?

A PowerShell module is a package containing cmdlets, functions, variables, and other resources that extend PowerShell’s capabilities.
Modules can be:

  • Built-in: Included with Windows (e.g., Microsoft.PowerShell.Management)
  • Custom: Created by you or your organization
  • Downloaded: From the PowerShell Gallery using Install-Module

Method 1: Use Get-Module -ListAvailable

The simplest way to check if a module is installed in PowerShell is by using:

Get-Module -ListAvailable

You can see all the installed modules, like in the screenshot below:

Check if a Module Is Installed using PowerShell

Example: Check for a specific module

Here is an example.

Get-Module -ListAvailable -Name Az

If the module is installed, you’ll see output similar to:

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name
---------- -------    ----
Script     11.3.1     Az

If there’s no output, the module isn’t installed.

Pro Tip:
Get-Module without -ListAvailable only shows modules loaded in the current session, not all installed modules.

Check out Get .NET Version Using PowerShell

Method 2: Use Get-InstalledModule (PowerShellGet)

If you installed modules using the PowerShell Gallery, use:

Get-InstalledModule

This command lists all modules installed via PowerShellGet.

Example: Check for a specific module

Let me show you an example.

Get-InstalledModule -Name PnP.PowerShell

If installed, you’ll see the module name and version. You can see the exact output in the screenshot below:

PowerShell Check if a Module Is Installed

If not, PowerShell throws an error like:

PackageManagement\Get-Package : No match was found for the specified search criteria and module name 'Az'.

Note:
If Get-InstalledModule shows no results, but you know modules exist, it may be due to different module paths between PowerShell 5.1 and PowerShell 7+

Read Pass Variables to a PowerShell Script

Method 3: Check Module Paths with $env:PSModulePath

PowerShell looks for modules in directories defined in the $env:PSModulePath environment variable.

$env:PSModulePath -split ';'

You can then manually check whether a module folder exists in those paths.

Example:

Test-Path "C:\Program Files\WindowsPowerShell\Modules\Az"

If it returns True, the module is installed in that location.

Method 4: Check Loaded Modules in the Current Session

If you want to see which modules are currently loaded:

Get-Module

This is useful when debugging scripts or checking dependencies dynamically.

Check out How to Run PowerShell as Different User?

Method 5: Conditional Check in Scripts

If you’re writing a script and need to verify module existence programmatically, use this pattern:

if (Get-Module -ListAvailable -Name Az) {
    Write-Host "Az module is installed."
} else {
    Write-Host "Az module is not installed. Installing now..."
    Install-Module -Name Az -Force
}

This ensures your script can self-heal by installing missing modules automatically.

Method 6: Cross-Version Considerations (PowerShell 5.1 vs 7.x)

PowerShell 5.1 (Windows PowerShell) and PowerShell 7+ (PowerShell Core) may use different module paths.
Modules installed in one version may not appear in the other.

To verify which version you’re using:

$PSVersionTable.PSVersion

If you need to make modules available across both versions, copy them into a shared module directory such as:

C:\Program Files\PowerShell\7\Modules

Check out Fix “PowerShell Running Scripts is Disabled on This System” Error

Troubleshooting Tips

IssuePossible CauseSolution
Get-InstalledModule shows nothingModule installed manually or via another userUse Get-Module -ListAvailable
Module found in 5.1 but not in 7.xDifferent $env:PSModulePath valuesAdd shared paths or reinstall
Module loads but commands not foundModule not imported correctlyRun Import-Module <ModuleName>
Access denied errorsInsufficient permissionsRun PowerShell as Administrator

In this tutorial, we learned how to check if a module is installed using PowerShell using different methods.

CommandPurpose
Get-Module -ListAvailableList all installed modules
Get-InstalledModuleList modules installed via PowerShell Gallery
Get-ModuleShow currently loaded modules
$env:PSModulePathView module search paths
Test-PathCheck if a module folder exists

You may also like:

Leave a Comment

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.