keepcalculator

06 Numbers and Powers

Cmdlet Not Recognized: Fix PowerShell Errors

Card No. 06·63166 · Updated · Standard formula, shown below

The calculator on this card is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

When PowerShell says “The term is not recognized as the name of a cmdlet,” it means the command you typed is not available in the current session, either because it doesn’t exist, isn’t installed, or isn’t in the script’s execution path. This article explains the most common causes and shows you step-by-step fixes, from simple typos to module installation and execution policy changes.

What Does “Not Recognized” Actually Mean?

PowerShell resolves a command by searching through a specific order: aliases, functions, cmdlets, and then executable files in the PATH environment variable. If none of these contain the name you typed, PowerShell returns the error:

The term 'xyz' is not recognized as the name of a cmdlet, function, script file, or operable program.

This is not a crash or a system failure; it’s PowerShell telling you it cannot find the command. The error has four parts it checks, and understanding each helps you diagnose the problem quickly.

Common Causes and Quick Fixes

Most often, the issue falls into one of these categories:

  • Typo or wrong capitalization: PowerShell is case-insensitive for command names, but a misspelling like Get-Processs will fail. Double-check the spelling.
  • Missing module: The command belongs to a module that isn’t installed or imported. For example, Get-MsolUser requires the MSOnline module.
  • Script execution policy: If you’re trying to run a .ps1 script, the execution policy might block it. This is separate from cmdlet recognition but often appears together.
  • Command not in PATH: If you’re trying to run an external executable (like ffmpeg or node), its folder must be in the system PATH variable.
  • Running in the wrong PowerShell version: Some commands exist only in PowerShell 5.1, others only in PowerShell 7.x. Check with $PSVersionTable.

For a quick check, use the Get-Command cmdlet to see if PowerShell knows about the name at all:

Get-Command <name> -ErrorAction SilentlyContinue

If nothing returns, the command isn’t available. If it returns something, the problem is likely how you’re calling it.

How to Find and Install the Right Module

If the command is part of a module, you need to install it first. The official repository is the PowerShell Gallery, accessible via Install-Module.

  1. Search for the module: Find-Module -Name *keyword* to see what’s available.
  2. Install it: Install-Module -Name ModuleName -Scope CurrentUser to avoid needing admin rights.
  3. Import it: In a new session, the module usually auto-loads, but you can force it with Import-Module ModuleName.
  4. Verify: Run Get-Command -Module ModuleName to list all its commands.

For example, the Microsoft.Graph module is a large set of commands for Microsoft 365. If you type Get-MgUser and get the error, you need to run Install-Module Microsoft.Graph first.

Script Execution Policy and Running .ps1 Files

Sometimes the error is about a script file, not a cmdlet. If you type .\myscript.ps1 and get the “not recognized” error, it might be because execution policy is set to Restricted (the default on Windows).

To check your current policy:

Get-ExecutionPolicy

To change it for the current user only (safe and common):

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

This allows local scripts to run but requires downloaded scripts to be signed. If you’re on a corporate machine, you may need an admin to change it. Also, always call scripts with the full path or .\ prefix; PowerShell doesn’t run scripts from the current directory by default for security reasons.

Handling External Executables and PATH

If the command is an .exe or .bat file, the “not recognized” error means Windows can’t find it in the PATH. To fix this:

  1. Find where the executable is installed (e.g., C:\Program Files\SomeApp\app.exe).
  2. Add that folder to the system PATH: Open System Properties → Environment Variables → edit Path → add the folder.
  3. Restart your PowerShell session to pick up the change.

Alternatively, you can call the executable with its full path directly: & "C:\Program Files\SomeApp\app.exe" arguments. The & call operator is needed if the path contains spaces.

PowerShell Versions and Compatibility

PowerShell 5.1 (Windows PowerShell) and PowerShell 7+ (Core) have different command sets. Some cmdlets are exclusive to one. For instance, Get-WindowsFeature exists only in Windows PowerShell with the ServerManager module, while Get-Uptime is new in PowerShell 6+.

To see which version you’re running:

$PSVersionTable.PSVersion

If a command works in one but not the other, you have two options: run the appropriate version, or find an equivalent command. Many modules are cross-version, but some are not. Always check the module’s documentation for compatibility.

Frequently Asked Questions

Why does my command work in one PowerShell window but not another?

This usually happens because the working window has a different module loaded or a different execution policy. Modules are loaded per session. If you installed a module with -Scope CurrentUser, it should be available in all your sessions, but if you imported it manually in one window, that import doesn’t carry over. Also, if one window is running as administrator, it may have access to modules in system locations that a normal user window doesn’t.

How do I see all available commands with a certain word?

Use Get-Command -Name *word* to list all commands (cmdlets, functions, aliases) that contain that word. For example, Get-Command -Name *process* shows all process-related commands. You can also filter by type: Get-Command -CommandType Cmdlet.

Can I create my own command to replace a missing one?

Yes, you can define a function with the same name. For example, if Get-Foo is missing, you can write function Get-Foo { ... } in your profile script. However, this only masks the problem; if the original command is part of a module, installing the module is the correct fix.

What does “not recognized as the name of a cmdlet, function, script file, or operable program” mean exactly?

It means PowerShell searched all four categories and found nothing. The categories are: cmdlets (built-in or from modules), functions (defined in the session or profile), script files (files with .ps1 extension in the current directory or PATH), and operable programs (executables in PATH). The error is a catch-all for “I don’t know this name.”

Why does a command work in the PowerShell ISE but not in the console?

The ISE and the console are separate hosts. They can have different execution policies and different module auto-loading behavior. The ISE also has a different profile. If a module is imported in your ISE profile but not in your console profile, the command will be missing in the console. Check your profiles with $PROFILE.

How do I permanently add a module so it’s always available?

Add an Import-Module line to your PowerShell profile. To edit your profile, run notepad $PROFILE (create it if it doesn’t exist). Add the import line, save, and restart PowerShell. This ensures the module is loaded every time you start a session.

Preventing the Error in the Future

To avoid this error, adopt these habits:

  • Always use Get-Command to verify a command exists before using it in a script.
  • Use tab completion — type the first few letters and press Tab to auto-complete the command name.
  • Keep your modules updated with Update-Module.
  • Document which modules your scripts require at the top using #Requires -Modules ModuleName.
  • If you write a script that uses a niche module, include installation instructions in comments.

By understanding how PowerShell resolves names, you can quickly diagnose and fix the “not recognized” error without guessing. The error is always a signal — either the command isn’t there, or PowerShell can’t see it. The steps above cover both cases.

Related

Formula used
in cmd | Command name | - | Get-Process | 1 | 50
sel scope | Scope | Current user=1, All users=2 | 1
out found | Command found? | - | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →