Import-Module failed in ManagementPack Script

Well same script works for you, and doesn’t works in ManagementPack script.

The only different is you are running in LocalSystem account, which is very common in SCOM.

The fix solution is easy too:

  • Either deploy your script to:

  •  Set $env:PSModulePath add your module path before Import-Module call.

Yes, I am having trouble import azure module in my MP script, and I fixed that.

The most import diagnostic step is run Get-Module –ListAvailable in SystemAccount, you will found the only PSModulePath is %SystemDrive%\Windows\System32\WindowsPowerShell\v1.0\Modules .

 

Leave a Reply