VMware Cloud Community
infra3
Enthusiast
Enthusiast
Jump to solution

SPBM Importing Error + Power CLI

getting Error importing SPBM

PowerCLI C:\> Import-SpbmStoragePolicy -Name "VSAN-ISCSI" -Description "New-ISCSI-Policy" -FilePath "C:\Users\Administrator\Desktop\POLICY\VSAN-ISCSI.xml

Import-SpbmStoragePolicy : 4/7/2018 6:46:31 AM    Import-SpbmStoragePolicy        Object reference not set to an instance of an object.

At line:1 char:1

+ Import-SpbmStoragePolicy -Name "VSAN-ISCSI" -Description "New-ISCSI-Test-Policy" ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Import-SpbmStoragePolicy], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Storage.Commands.Cmdlets.Spbm.ImportSpbmStoragePolicy

Also I tried to update module getting below

PowerCLI C:\> Update-Module
Update-Module : The 'Update-Module' command was found in the module 'PowerShellGet', but the module could not be loaded. For more information, run
'Import-Module PowerShellGet'.
At line:1 char:1
+ Update-Module
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Update-Module:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

PowerCLI C:\>

Tags (1)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Did you do that on a Windows 2012 server or a Windows 2012 R2 server?

Because that is a typical error when trying to install the W2K12 version on a W2K12R2 server.

If it is a Windows 2012 R2 server, you need package Win8.1AndW2K12R2-KB3191564-x64.msu.

wmf51.png


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

10 Replies
LucD
Leadership
Leadership
Jump to solution

Can you:

  • close all your PowerShell/PowerCLI sessions
  • uninstall all existing PowerCLI modules (uninstall in case you're running a MSI install, or by deleteing the PowerCLI folders)
  • start a PowerShell prompt
  • Try Install-Module -Name VMware.PowerCLI again


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
infra3
Enthusiast
Enthusiast
Jump to solution

HI,

After removing I got below error

PS C:\Users\Administrator> Install-Module -Name VMware.PowerCLI

Install-Module : The 'Install-Module' command was found in the module 'PowerShellGet', but the module could not be

loaded. For more information, run 'Import-Module PowerShellGet'.

At line:1 char:1

+ Install-Module -Name VMware.PowerCLI

+ ~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Can you try running the following from an elevated prompt?

Does that make a difference?

Install-PackageProvider -Name NuGet -Force

Install-Module PowerSHellGet -Force

Install-Module -Name VMware.PowerCLI -AllowClobber -Force


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
infra3
Enthusiast
Enthusiast
Jump to solution

Getting below error

PS C:\Users\Administrator> Install-PackageProvider -Name NuGet -Force
Install-PackageProvider : The term 'Install-PackageProvider' 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:1 char:1
+ Install-PackageProvider -Name NuGet -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Install-PackageProvider:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\Administrator> Install-Module PowerSHellGet -Force
Install-Module : The 'Install-Module' command was found in the module 'PowerShellGet', but the module could not be
loaded. For more information, run 'Import-Module PowerShellGet'.
At line:1 char:1
+ Install-Module PowerSHellGet -Force
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

PS C:\Users\Administrator> Install-Module -Name VMware.PowerCLI -AllowClobber -Force
Install-Module : The 'Install-Module' command was found in the module 'PowerShellGet', but the module could not be
loaded. For more information, run 'Import-Module PowerShellGet'.
At line:1 char:1
+ Install-Module -Name VMware.PowerCLI -AllowClobber -Force
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

PS C:\Users\Administrator

0 Kudos
LucD
Leadership
Leadership
Jump to solution

What does this return?

Get-Module -ListAvailable -Name PackageManagement

And this?

$env:PSModulePath.Split(';')

And this

$PSVersionTable

Are you perhaps sitting behind a proxy?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
infra3
Enthusiast
Enthusiast
Jump to solution

PS C:\Users\Administrator> Get-Module -ListAvailable -Name PackageManagement


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...


PS C:\Users\Administrator> $env:PSModulePath.Split(';')
C:\Users\Administrator\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\
PS C:\Users\Administrator> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.42000
BuildVersion                   6.3.9600.18773
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2


PS C:\Users\Administrator>

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Ok, you are running some older versions it seems.

I would advise to first upgrade your PowerShell version, for example to 5.1.

Download here.

When done, check if you PackageManagment module still says version 1.0.0.0.

If it does, update the module to the latest version.

Install-Module -Name PackageManagement -Force

When that is done, try again to install PowerCLI 10.
Eventually first run the 3 lines I gave earlier.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

infra3
Enthusiast
Enthusiast
Jump to solution

I have downloaded this and get error - this update not applicable for this server

W2K12-KB3191565-x64

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you do that on a Windows 2012 server or a Windows 2012 R2 server?

Because that is a typical error when trying to install the W2K12 version on a W2K12R2 server.

If it is a Windows 2012 R2 server, you need package Win8.1AndW2K12R2-KB3191564-x64.msu.

wmf51.png


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

infra3
Enthusiast
Enthusiast
Jump to solution

Thanks it worked .

let me check SPBM results and update you

0 Kudos