Environment
OS: Debian 9 Stretch amd64
PS /root> get-host
Name : ConsoleHost
Version : 6.1.0-preview.2
InstanceId : 87acc50e-d2c7-4bf8-a667-5ddb22848a61
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : de-DE
CurrentUICulture : de-DE
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Import-Module VMware.VimAutomation.Core
Get-Module VMware* | Select Name,Version
PS /root> Get-Module VMware* | Select Name,Version
Name Version
---- -------
VMware.Vim 6.7.0.8343295
VMware.VimAutomation.Cis.Core 10.1.0.8377811
VMware.VimAutomation.Common 10.1.0.8342134
VMware.VimAutomation.Core 10.1.0.8344055
VMware.VimAutomation.Sdk 10.1.0.8342078
Description
Due to the new possibilites Microsoft offers the Linux community, I installed Microsoft PowerShell and Vmware PowerCLI on Debian.
I want Zabbix Proxy to query VMware vCenter via External check.
I wrote the following script:
#!/usr/bin/pwsh
param(
[string]$Server,
[string]$User,
[string]$Password,
[string]$VM
)
Import-Module VMware.VimAutomation.Core
Connect-VIServer -Server $Server -User $User -Password $Password -Force | Out-Null
$snapshot = Get-Snapshot -VM $VM
$snapshot.Count
Disconnect-VIServer -Server * -Force -Confirm:$false
The script works very vell, when I start it in my SSH session. But as soon as Zabbix executes the script, the Module fails:
VERBOSE: Import-Module:
Import-Module : The type initializer for 'VMware.VimAutomation.ViCore.Util10.SettingsManager' threw an exception.
At /usr/lib/zabbix/externalscripts/vmware.vm.snapshot.count.ps1:22 char:1
+ Import-Module VMware.VimAutomation.Core
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [Import-Module], TypeInitializationException
+ FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.PowerShell.Commands.ImportModuleCommand
Is this a bug I can report anywhere? Is this egiable for Vmware support? Or can someone help me here?