install-module is not recognized as an internal or external command operable program or batch file

Are you trying to install a PowerShell module like SqlServer, dbatools, or Az and you see this error:

'Install-Module' is not recognized as an internal or external command,
operable program or batch file.

Do not worry; I will explain how to fix this error.

Recently, I got this error while installing the below cmdlet:

Install-Module -Name SqlServer -Scope CurrentUser

You can see the exact error in the screenshot below.

install-module is not recognized

The error means your current PowerShell environment doesn’t recognize the Install-Module cmdlet. This happens because:

  1. You’re running Command Prompt (cmd.exe) instead of PowerShell.
  2. You’re using an old PowerShell version (below 5.0).
  3. The PowerShellGet or PackageManagement modules are missing or broken.
  4. Your execution policy or environment variables are blocking module installation.

Now, let us go through the solutions:

Solution 1: Upgrade to PowerShell 7 (Recommended)

This solution personally works for me. When I run the cmdlet using PowerShell 7, the error does not come. Here is a screenshot of this.

install-module is not recognized as an internal or external command operable program or batch file

If you are not using PowerShell 7, you can upgrade to it.

PowerShell 7 includes the latest versions of:

  • PowerShellGet
  • PackageManagement
  • NuGet Provider
  • Download PowerShell 7: Go to the official Microsoft GitHub page:

👉 https://github.com/PowerShell/PowerShell

Download the latest PowerShell 7.x MSI installer for Windows.

  • Install PowerShell 7
    • Run the installer.
    • Accept the defaults (it will install to C:\Program Files\PowerShell\7).
    • Check “Add to PATH” when prompted.

To verify whether Open PowerShell 7 is appropriately installed, you can open PowerShell 7 and run the following cmdlet.

$PSVersionTable.PSVersion

You should see something like:

Major  Minor  Build  Revision
-----  -----  -----  --------
7      4      1      0

After this, you should run the following cmdlet.

Install-Module -Name SqlServer -Scope CurrentUser -Force

It should work immediately.

Check out PowerShell Get-WindowsAutoPilotInfo

Solution 2: Make Sure You’re in PowerShell (Not CMD)

If your prompt looks like this:

C:\Users\Admin>

You’re in Command Prompt, not PowerShell.

Open PowerShell by:

  • Pressing Windows + R, typing powershell, then pressing Enter, or
  • Searching for PowerShell in the Start menu.

You should see:

PS C:\Users\Admin>

Now try:

Get-Command Install-Module

Check out RPC Server is Unavailable Error in PowerShell

Solution 3: Install or Repair PowerShellGet and PackageManagement Modules

Sometimes, the PowerShellGet or PackageManagement modules are missing or corrupted.

Run the following commands in PowerShell (Run as Administrator):

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

Install-PackageProvider -Name NuGet -Force
Install-Module -Name PowerShellGet -Force -AllowClobber

Then restart PowerShell and try again:

Install-Module -Name SqlServer -Scope CurrentUser

If you still get the same error, proceed to manual installation.

Check out How to Check if a Module Is Installed using PowerShell?

Solution 4: Manually Install the Module

If your system still doesn’t recognize Install-Module, you can manually download and install the module.

Visit the PowerShell Gallery:
👉 https://www.powershellgallery.com/packages/SqlServer

Click “Manual Download”.

Extract the .nupkg file (it’s a ZIP archive) to

C:\Users\<YourUserName>\Documents\WindowsPowerShell\Modules\SqlServer

Restart PowerShell.

Verify installation:

Get-Module -ListAvailable SqlServer

Import and test:

Import-Module SqlServer
Get-Command -Module SqlServer

Solution 5: Check Execution Policy

If your execution policy blocks scripts, PowerShell won’t run module commands.

Run:

Get-ExecutionPolicy

If it shows Restricted, change it to allow local scripts:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Then restart PowerShell and try again.

Conclusion

The error ‘Install-Module’ is not recognized as an internal or external command, operable program or batch file occurs because your system either doesn’t recognize PowerShell commands or is missing the necessary module infrastructure.

The best and most permanent fix is to upgrade to PowerShell 7, which comes with all the modern tools preinstalled and compatible with the PowerShell Gallery.

If you can’t upgrade, the other solutions — verifying your version, reinstalling PowerShellGet, fixing PATH, or manually installing modules — will also get you back up and running.

You may also like the following tutorials:

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

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