itglue / powershellwrapper

This PowerShell module acts as a wrapper for the IT Glue API.
Apache License 2.0
120 stars 51 forks source link

Exception from HRESULT: 0x80131047 #130

Closed ecspresso closed 1 year ago

ecspresso commented 3 years ago

Steps to reproduce

Import-Module IT GlueAPI

Expected behavior

The module is imported

Actual behavior

Error: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

 

Running from Windows causes not problem at all. Running it from our RMM generated the above error. Someone had the same problem in PowerShell/PowerShell#3059 and this was the solution:

My RootModule in my .psd1 was prefixed with .\. Perhaps this may help.

Changing it from '.\ITGlueAPI.psm1' to "$PSScriptRoot\ITGlueAPI.psm1" solves the issue while still referencing the the correct path.

 

I will create a pull request.

davidhaymond commented 3 years ago

I think RootModule should omit the path prefix entirely. See Microsoft's documentation and example for RootModule. Using the root module name only has worked for me in my own modules.

RootModule = "ITGlueAPI.psm1"
ecspresso commented 3 years ago

@davidhaymond You are most likely right but I cannot test this at the moment so I will leave it as is and let someone with more knowledge on the subject decide what to do.