PoshCode Archive  Artifact Content

Artifact 7dc606dad2c738d683f7d022ae8c318047bfab0c1f60aecc666e77882a77279f:

  • File Vim25-less-Crazy-Magic.ps1 — part of check-in [e20cc35e97] at 2018-06-10 12:58:10 on branch trunk — Execute methods on vimService ESXi w/o using VMware assemblies. (user: waldo size: 1133)

# encoding: ascii
# api: powershell
# title: Vim25-less Crazy Magic
# description: Execute methods on vimService ESXi w/o using VMware assemblies.
# version: 4.0.0
# author: waldo
# license: CC0
# x-poshcode-id: 1526
# x-archived: 2010-09-13T05:18:30
#
#
cls

$ws  =  New-WebServiceProxy -Uri "http://192.168.1.1/sdk/vimService?wsdl" -Namespace "vimService1" ;

$ws.Url = "http://192.168.1.1/sdk/vimService";
$ws.UserAgent = "VMware VI Client/4.0.0";
$ws.CookieContainer = New-Object system.net.CookieContainer;

$mor_ret = new-object vimService1.ManagedObjectReference;

$mor_si = new-object vimService1.ManagedObjectReference;
$mor_si.type = "ServiceInstance";
$mor_si.Value = "ServiceInstance";

$mor_sm = new-object vimService1.ManagedObjectReference;
$mor_sm.type = "SessionManager";
$mor_sm.Value = "ha-sessionmgr";

$mor_hs = new-object vimService1.ManagedObjectReference;
$mor_hs.type = "HostSystem";
$mor_hs.Value = "ha-host";

$us = $ws.Login($mor_sm,"root","root", "en");

write-Host $ws.CurrentTime($mor_si);

#$mor_ret = $ws.RebootHost_Task($mor_hs, $true);

$ws.Logout($mor_sm);