How Do You Troubleshoot the Powershell Error “Cannot find Get-Command”?

Problem scenario
You run a PowerShell command.  You get "Cannot find Get-Command" even though the command you entered was not Get-Command.  How do you solve this error?

Possible Solution #1
As an Admininstrator of the server, go to Server Manager -> Tools -> Computer Management.  In this Window (or MMC) go to System Tools -> Local Users and Groups -> Users.  Double click on the User that received the error.  

Is the user a member of Guests or Users?  Is this intentional?  You may want to add the user to a group.

Are environmental variables set as normal?  Will commands like "ls", "dir" or "whoami" work?  If not run these commands:


This may help you troubleshoot the problem.

Possible Solution #2
Are you using JEA when this problem exists?  If so, is your PowerShell Service Configuration (.pssc) file set to run as a virtual account?  That is, do you have a stanza such as one of these below?

# RunAsVirtualAccount = $true
RunAsVirtualAccount = $false

The top one is commented out.   Without using a virtual account, certain variables may not be readily available in the session.  If the "whoami" command does not work, try this: "$env:UserName" # with no quotes.

Leave a comment

Your email address will not be published. Required fields are marked *