Press "Enter" to skip to content

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
Files\WindowsPowerShell\Modules\VMware.PowerCLI\11.2.0.12780525\VMware.PowerCLI.psd1'.
At line:1 char:1
+ Import-Module VMware.PowerCLI
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (C:\Program File...e.PowerCLI.psd1:String) [Import-Module], Missing
   MemberException
    + 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
   otFoundException
    + 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.

Explorer Module

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
Files\WindowsPowerShell\Modules\VMware.VimAutomation.StorageUtility\1.3.0\VMware.VimAutomation.StorageUtility.psd1'
specifies module version '1.3.0.0' 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
   idOperationException
    + FullyQualifiedErrorId : Modules_InvalidModuleManifestVersion,Microsoft.PowerShell.Commands.TestModuleManifestCom
   mand

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 “1.3.0.0” resolves the issue.

Rename-Item "C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.StorageUtility\1.3.0" "1.3.0.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.

Be First to Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: