Hello,
I'm trying to find a way to incorporate POWERCLI modules in an application I'm building so that when it's pulled from GITHUB, it will have all the right requirements to run.
- I've downloaded the entire VMware.PowerCLI module locally
- I've tried adding all the calls for the psm1 modules in the correct order
Import-Module "$ScriptPath\RequiredModules\VMware.VimAutomation.Sdk\VMware.VimAutomation.Sdk.psm1"
Import-Module "$ScriptPath\RequiredModules\VMware.VimAutomation.Common\VMware.VimAutomation.Common.psm1"
Import-Module "$ScriptPath\RequiredModules\VMware.Vim\VMware.Vim.psm1"
Import-Module "$ScriptPath\RequiredModules\VMware.VimAutomation.Cis.Core\VMware.VimAutomation.Cis.Core.psm1"
Import-Module "$ScriptPath\RequiredModules\VMware.VimAutomation.Core\VMware.VimAutomation.Core.psm1"
- If I run the above directly from the PowerShell console it works but if I have those same lines included in a script ps1 file, it fails with:
Import-Module : Could not load file or assembly
'file:///D:\RequiredModules\VMware.VimAutomation.Sdk\net45\log4net.dll' or one of its dependencies.
Operation is not supported. (Exception from HRESULT: 0x80131515)
At D:\RequiredModules\VMware.VimAutomation.Sdk\VMware.VimAutomation.Sdk.psm1:23 char:17
Not sure what the difference is but surely there is a better way to inlcude and load the PowerCLI modules into a script to be able to run anywhere.
Thanks.