Program is used to shutdown gracefully VM and host.
Host VMware Vsphere 7 Essential with VCenter 7
VM Client : CentOS 7 x64 and CentOS 8 x64 too.
APC UPS SMT1500rmiU2 WITH COM port connection with host
VMTools instaled and running
APC PowerChuteBusinessEdition 10.0.1-301
VMware.PowerCLI 12.0.0.159447286
PowerShell for Unix PSversion 7.0.3
- SElinux disabled
- chmod +x x.sh
- chmod +x x.ps1
PowerShell file:x.ps1
--------------------------
$VCenter = 'vcenter7sa.st.local'
$User = 'administrator@vsphere.local'
$Password = '******'
$Port = '443'
$Protocol = 'https'
Connect-VIServer -Server $VCenter -Port $Port -Protocol $Protocol -User $User -Password $Password
File x.sh
--------------------------
#!/usr/bin/pwsh /opt/APC/PowerChuteBusinessEdition/Agent/cmdfiles/x.ps1
1.
running x.sh from linux console with ./x.sh
Result OK:
Name | Port User |
---- | ---- ---- |
vcenter7sa.st.local | 443 VSPHERE.LOCAL\Administrator |
2.
running the same x.sh from APC PBEagent
Result ERROR:
Connect-VIServer: /opt/APC/PowerChuteBusinessEdition/Agent/cmdfiles/x.ps1:10
Line |
10 | Connect-VIServer -Server $VCenter -Port $Port -Protocol $Protocol -Us …
| ~~~~~~~~~~~~~~~~
| The term 'Connect-VIServer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Any suggestions ?