Site icon Check the Cache

Fix: The required module ‘VMware.VimAutomation.StorageUtility’ is not loaded

Recently on a handful of systems, particularly Server 2016, I was having an issue with installing PowerCLI. When running the module import command it was failing citing “VMware.VimAutomation.StorageUtility” as the issue.

Import-Module VMware.PowerCLI
Import-Module : The required module 'VMware.VimAutomation.StorageUtility' is not loaded. Load the module or remove the
module from 'RequiredModules' in the file 'C:\Program
At line:1 char:1
+ Import-Module VMware.PowerCLI
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (C:\Program File...e.PowerCLI.psd1:String) [Import-Module], Missing
    + FullyQualifiedErrorId : Modules_InvalidManifest,Microsoft.PowerShell.Commands.ImportModuleCommand

Check the module by importing it alone with verbose output:

Import-Module -Verbose VMware.VimAutomation.StorageUtility
VERBOSE: Skipping the Version folder 1.3.0 under Module C:\Program
Files\WindowsPowerShell\Modules\VMware.VimAutomation.StorageUtility as it does not have a valid module manifest file.
Import-Module : The specified module 'VMware.VimAutomation.StorageUtility' was not loaded because no valid module file
was found in any module directory.
At line:1 char:1
+ Import-Module -Verbose VMware.VimAutomation.StorageUtility
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (VMware.VimAutomation.StorageUtility:String) [Import-Module], FileN
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Based on the error the module manifest has an issue. We’ll need to check it to see what’s the problem. For my system the module installed to %ProgramFiles%\WindowsPowerShell\Modules. Checking that directory I found the module and the manifest.

Testing the module manifest for issues:

Test-ModuleManifest "C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.StorageUtility\1.3.0\VMware.VimAutomation.StorageUtility.psd1"
Test-ModuleManifest : The ModuleVersion key in module manifest 'C:\Program
specifies module version '' which does not match its version folder name at 'C:\Program
Files\WindowsPowerShell\Modules\VMware.VimAutomation.StorageUtility\1.3.0'. Change the value of the ModuleVersion key
to match the version folder name.
At line:1 char:1
+ Test-ModuleManifest "C:\Program Files\WindowsPowerShell\Modules\VMwar ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (C:\Program File...ageUtility.psd1:String) [Test-ModuleManifest], Inval
    + FullyQualifiedErrorId : Modules_InvalidModuleManifestVersion,Microsoft.PowerShell.Commands.TestModuleManifestCom

This error says the manifest version does not match the folder name. Which we can see in explorer when we navigated to the folder. Renaming the folder from “1.3.0” to “” resolves the issue.

Rename-Item "C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.StorageUtility\1.3.0" ""
Import-Module VMware.PowerCLI
          Welcome to VMware PowerCLI!

Log in to a vCenter Server or ESX host:              Connect-VIServer
To find out what commands are available, type:       Get-VICommand
To show searchable help for all PowerCLI commands:   Get-PowerCLIHelp
Once you've connected, display all virtual machines: Get-VM
If you need more help, visit the PowerCLI community: Get-PowerCLICommunity

       Copyright (C) VMware, Inc. All rights reserved.
Exit mobile version