My question is hos to I use PHP / SOAP calls to enable Lockdown mode? The ESXi host is controlled via a vCenter Server and I'm able to connect to the system and perform other tasks.
Hers a quick snippet:
$soapmsg['this'] = new soapval('_this','SearchIndex','SearchIndex'); | |
$soapmsg['dnsName'] = "esxi1"; | |
$soapmsg['vmSearch'] = "false"; | |
// $result2 = $client->call('FindByIp',$soapmsg,$namespace); | |
$result2 = $client->call('FindByDnsName',$soapmsg,$namespace); |
This works fine. Just to test my code I run the following.
unset($soapmsg); | |
$soapmsg['this'] = new soapval('_this','HostSystem',$result2); |
$soapmsg['timeout'] = 10; |
$result3 = $client->call('ExitMaintenanceMode_Task',$soapmsg,$namespace);
-----------------
Now when I runs the next piece of code it fails.
$soapmsg['task'] = $result3; |
$result4 = $client->call('EnterLockdownMode',$soapmsg,$namespace)
-----------------
This is the error I receive when I execute the query.
host-78 <= This is good .. It found the ESXi host
----------
task-81060 <= This is good as well . It tried to take the ESXiout of Maintenance mode.
----------
Array
(
[faultcode] => ServerFaultCode
[faultstring] => Unable to resolve WSDL method name EnterLockdownMode for namespace name urn:vim25
while parsing SOAP body
at line 1, column 346
while parsing SOAP envelope
at line 1, column 43
while parsing HTTP request before method was determined
at line 1, column 0
[detail] => Array
(
[InvalidRequestFault] =>
)
)
-----
Has anyone had any luck with using the EnterLockdownMode method???