Issue: CommandNotFoundException Import-Module

Issue: you are unable to use the command “Import-Module” in Windows PowerShell and receive the following error:  FullyQualifiedErrorId : CommandNotFoundException Import-Module -Name AzureRM Import-Module : The specified module ‘AzureRM’ was not loaded because no valid module file was found in any module directory. At line:1 char:1

Solution:

  1. Confirm you have powershell 5.0 (Windows Management FrameWork Version 5)
    enter the following command into PowerShell: “$PSVersionTable.PSVersion”
    Also enter the following command: “host”
    review the major version in the first command and the version stated in the second command, both should be 5.x
  2. Import PowerShellGet, which contains the import-module function.
    Import-Module -Name PowerShellGet
    Check if you have the folder: C:\Program Files\WindowsPowerShell\Modules\PowerShellGet

Related

Leave a Reply

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