Can't import PS5 module into PS7

112 views Asked by At

I've tried this on a few systems so I think it's something with the module itself, but I'm not sure what to look for.

Code

Import-Module PSWriteHtml -UseWindowsPowerShell -WarningAction Ignore

Error

Import-Module: Failed to generate proxies for remote module 'PSWriteHtml'. Cannot process argument because the value of argument "name" is null. Change the value of argument "name" to a non-null value.

Links to the module

https://github.com/EvotecIT/PSWriteHTML

https://www.powershellgallery.com/packages/PSWriteHTML/0.0.158

Additional info

One thing is that on my development machine, I didn't need to import the module at all. When I tried to run my script on the target server (Windows Server 2012 R2), I got an error that the cmdlet was not recognized. I also noted that C:\Program Files\WindowsPowerShell\Modules is missing from $Env:PSModulePath

$Env:PSModulePath -split (';')

C:\Users\swtto\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\7\Modules
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell\

When I inspect the system environment variable, I don't see the other paths, not sure why.

%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell\
0

There are 0 answers