HewlettPackard / POSH-HPEOneView

PowerShell language bindings library for HPE OneView.
http://hewlettpackard.github.io/POSH-HPEOneView/
125 stars 52 forks source link

import-module : The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) #553

Closed shawnzzzy closed 2 years ago

shawnzzzy commented 3 years ago

Hello,

I'm able to install HPEOneView.550 but then i cannot import it. Here is the results of running the import-module:

PS C:\WINDOWS\system32> import-module HPEOneView.550
import-module : The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
At line:1 char:1
+ import-module HPEOneView.550
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileLoadException
    + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

Any ideas what the issue is?

Here is my PowerShell Version Table:

PS Z:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.610
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.610
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
ChrisLynchHPE commented 3 years ago

How did you install the module? What happens if you were to do the following:

# You will need to ensure you have changed the directory to where the module is installed to
Test-ModuleManifest .\HPEOneView.550.psd1
ChrisLynchHPE commented 3 years ago

As long as you are installing the module from PowerShell Gallery (Install-Module HPEOneView.550), the module loads just fine on my Windows 10 PC when using PowerShell 5.1. So this seems to be an issue with your PC that I'm not sure how to handle this.

shawnzzzy commented 3 years ago
Test-ModuleManifest .\HPEOneView.550.psd1
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.50.26... HPEOneView.550                      {Set-OVAlertAssignToUser, New-OVSnmpV3User, Get-OVApplianceTwoFactorAuthentication, Get-OVComposerNode...}
shawnzzzy commented 3 years ago

I installed it using:

# Install library from the PowerShell Gallery
Install-Module HPEOneView.550
shawnzzzy commented 3 years ago

As long as you are installing the module from PowerShell Gallery (Install-Module HPEOneView.550), the module loads just fine on my Windows 10 PC when using PowerShell 5.1. So this seems to be an issue with your PC that I'm not sure how to handle this.

I wonder if it's because the module location is in my local OneDrive. I'll try to install it to a different path.

ChrisLynchHPE commented 3 years ago

My Windows 10 PC is setup the same way, where modules are installed to the OneDrive redirected My Documents folder. I had no issues installing and then loading the module in this way.

ChrisLynchHPE commented 2 years ago

Closing due to no further activity. If you wish, feel free to re-open to discuss further.