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 CurrentUserYou can see the exact error in the screenshot below.

The error means your current PowerShell environment doesn’t recognize the Install-Module cmdlet. This happens because:
- You’re running Command Prompt (cmd.exe) instead of PowerShell.
- You’re using an old PowerShell version (below 5.0).
- The PowerShellGet or PackageManagement modules are missing or broken.
- 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.

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.PSVersionYou should see something like:
Major Minor Build Revision
----- ----- ----- --------
7 4 1 0After this, you should run the following cmdlet.
Install-Module -Name SqlServer -Scope CurrentUser -ForceIt 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-ModuleCheck 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 -AllowClobberThen restart PowerShell and try again:
Install-Module -Name SqlServer -Scope CurrentUserIf 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\SqlServerRestart PowerShell.
Verify installation:
Get-Module -ListAvailable SqlServerImport and test:
Import-Module SqlServer
Get-Command -Module SqlServerSolution 5: Check Execution Policy
If your execution policy blocks scripts, PowerShell won’t run module commands.
Run:
Get-ExecutionPolicyIf it shows Restricted, change it to allow local scripts:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserThen 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:
- Check Hard Drive Space using PowerShell
- How to Get .NET Version Using PowerShell?
- How to Run PowerShell as Different User?
- Fix “PowerShell Running Scripts is Disabled on This System” Error
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.