I've written a script to shut down groups of VMs in my cluster. I get a view of a VirtualMachine object, check the value of the guest.toolsRunningStatus property and then call ShutdownGuest() if the tools are running.
Sometimes the guest.toolsRunningStatus property is set to 'guestToolsRunning' even when the tools are not running, e.g. when the VMware Tools Service is stopped in a Windows VM. In these cases, SOAP Fault ToolsUnavailable messages are printed to stderr. How can I capture these faults without redirecting stderr and parsing the messages? ShutdownGuest() does not return anything.
Hi,
you have to do silly things :smileygrin: see the following code:
my $blah = undef;
eval{
$blah = guest.toolsRunningStatus();
};
if($@) {
print "your Exception";
}
When in the eval-block occours an error thats piped in stderr, the error message will be pipe in $@.
So when $@ is set, in $@ will be the SoapFault-Object.
I hope that will help you.
Henning
Hi,
you have to do silly things :smileygrin: see the following code:
my $blah = undef;
eval{
$blah = guest.toolsRunningStatus();
};
if($@) {
print "your Exception";
}
When in the eval-block occours an error thats piped in stderr, the error message will be pipe in $@.
So when $@ is set, in $@ will be the SoapFault-Object.
I hope that will help you.
Henning