Both were working just fine until I upgraded SwisPowerShell to version 3.2.0.50049.
Now, if I load SwisPowerShell first I cannot load VMWare.PowerCli anymore.
And if I load VMWare.PowerCli first, then the Connect-Swis cmdlet returns an error.
This behavior only appears in a PowerShell 7 host (7.3.6 precisely in my case).
PS> Import-Module -Name VMware.PowerCLI
Welcome to VMware PowerCLI!
Log in to a vCenter Server or ESX host: Connect-VIServer
To find out what commands are available, type: Get-VICommand
To show searchable help for all PowerCLI commands: Get-PowerCLIHelp
Once you've connected, display all virtual machines: Get-VM
If you need more help, visit the PowerCLI community: Get-PowerCLICommunity
Copyright (C) VMware, Inc. All rights reserved.
PS> Connect-Swis -Hostname $OrionDatabaseServer -Credential $OrionCred
Connect-Swis: The type initializer for 'SolarWinds.InformationService.Contract2.InfoServiceProxy' threw an exception.
Troubleshooting
What is strange is that even after unloading the other module, the issue still remains in both cases.
As a workaround, downgrading SwisPowerShell to version 3.1.0.343 fixes the issue.
I noticed this behavior only in a PS7 host.
So using a PowerShell 5.1 host can be another workaround.
Both were working just fine until I upgraded SwisPowerShell to version 3.2.0.50049.
Now, if I load SwisPowerShell first I cannot load VMWare.PowerCli anymore. And if I load VMWare.PowerCli first, then the
Connect-Swis
cmdlet returns an error.This behavior only appears in a PowerShell 7 host (7.3.6 precisely in my case).
Loading SwisPowerShell first
Loading VMware.PowerCLI first
Troubleshooting
What is strange is that even after unloading the other module, the issue still remains in both cases.
As a workaround, downgrading SwisPowerShell to version 3.1.0.343 fixes the issue.
I noticed this behavior only in a PS7 host. So using a PowerShell 5.1 host can be another workaround.