Hi ,
i have installed the VSphere Client Ver4.1.0.
i want to create a simple C# application which connect to this VSphere Client, and power on a Virtual machine, and after that Virtual machine will be powered it off and disconnect the connection from VSphere Client.
i have installed vSphere PowerCLI, and below is the dlls versions.
VMware.VimAutomation.ViCore.Cmdlets.dll ver 4.1.0.2519
VMware.VimAutomation.ViCore.Impl.dll ver 4.1.0.2519
VMware.VimAutomation.ViCore.Interop.dll ver 4.1.0.2519
VMware.VimAutomation.ViCore.Types.dll ver 4.1.0.2519
VMware.VimAutomation.ViCore.Util10.dll ver 4.1.0.2519
VMware.VimAutomation.ViCore.Util10Ps.dll ver 4.1.0.2519
i am able to connect to the VSphere client using the below code but how to power On a particular virtual machine is problem kindly can anybody give sample application or guidance.
try
{
ConnectVIServer ConnectServer = new ConnectVIServer();
ConnectServer.User = "corp
xyz";
ConnectServer.Password = "xyz@007";
ConnectServer.Protocol = "https";
string[] serverName = new string[] { "dev.You.com" };
ConnectServer.Server = serverName;
System.Collections.IEnumerable iEnum = ConnectServer.Invoke();
GetVM getVM = new GetVM();
string[] vmName = new string[] { "Win2003SR2SP2-01-23" };
getVM.Name = vmName;
Listd__0' to type 'System.Collections.Generic.IEnumerable`1[http://VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine|http://VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine]'.
]]
StartVM startVM = new StartVM();
startVM.VM = vm.ToArray();
startVM.Invoke();
DisconnectVIServer DisConnect = new DisconnectVIServer();
DisConnect.Invoke();
}
if i am doing anything wrong kindly guide me in proper way.
"hristov" given good response please refer this URL (http://communities.vmware.com/message/1623581#1623581) for better understanding.
Thanks in advance,
Shaik.