In this Azure tutorial, we will discuss how to fix the error. The term ‘Get-VM’ is not recognized as the name of a cmdlet, which comes while trying to get the VM details using PowerShell.
Table of Contents
The term ‘Get-VM’ is not recognized as the name of a cmdlet
Recently, while trying to execute the Get-VM PowerShell command, I got the above error message
Get-VM

The complete error message is
Get-VM : The term ‘Get-VM’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:3 char:1
- Get-VM
~~- CategoryInfo : ObjectNotFound: (Get-VM:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
The term ‘Get-VM’ is not recognized as the name of a cmdlet [Solved]
To fix this error, you need to follow the below steps.
Step-1:
Import the Hyper-V module
import-module Hyper-V
After executing the above command, I got the below error

The error is
Import-module: The specified module ‘Hyper-V’ was not loaded because no valid module file was found in any module directory.
To fix this error, You need to follow the below steps
Step-1:
Open the control panel –>Programs –> Program and features –> Turn Windows features on or off

Step-2:
Check the Hyper-V modules like below and click on the OK button,

Step-3:
This will search for the files and will apply the changes.

Step-4:
Now, the changes have been added successfully. It will ask to restart. Click on the Restart Now button to finish the installation.

Note: Until you restart the system, the changes will not be affected. So click on the Restart Now button to continue.
Now, to verify the modules are correctly installed, Go to the path below and see if the Hyper-V module is present.
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\Hyper-V

Now, I reran the Get-VM PowerShell command successfully. See below
Get-VM
You may like the following Azure tutorial:
- The term ‘New-AzResourceGroup’ is not recognized as the name of a cmdlet
- The Server Was Not Found Or Was Not Accessible
- The term ‘Get-AzTableRow’ is not recognized as the name of a cmdlet
In this tutorial, we discussed how to fix the error. The term ‘Get-VM’ is not recognized as the name of a cmdlet.
I hope it helped you to fix your issue.
I am Bijay, a Microsoft MVP (10 times) having more than 17 years of experience in the software industry. During my IT career, I got a chance to share my expertise in SharePoint and Microsoft Azure, like Azure VM, Azure Active Directory, Azure PowerShell, etc. I hope you will learn from these Azure tutorials. Read more