I am trying to control an ESXi host via the vSphere SDK. After successfully compiling the .NET samples on my Windows 7 machine I am unable to connect to the ESXi host. I have tried SimpleClient and Connect but had no success.
I have tried:
Command | Output |
---|---|
Connect.exe --url 192.168.x.x --username root --password mypassword | Caught Exception : Name : UriFormatException |
Connect.exe .exe --url http://192.168.x.x --username root --password mypassword | Caught Exception : Name : WebException Message : The request failed with the error message: -- <HTML><BODY><H1>301 Moved Permanently</H1></BODY></HTML> |
Connect.exe --url https://192.168.x.x --username root --password mypassword | Started There were one or more problems with the server certificate: * A certification chain processed correctly, but terminated in a root certificat e which isn't trusted by the trust provider. * The certificate's CN name does not match the passed value. Caught Exception : Name : WebException Message : The request failed with HTTP s tatus 400: Bad Request. |
SimpleClient.exe 192.168.x.x root mypassword | Caught Exception : Name : UriFormatException Message : Invalid URI: The format of the URI could not be determined. |
SimpleClient.exe http://192.168.x.x root mypassword | Caught Exception : Name : UriFormatException Message : Invalid URI: The format |
SimpleClient.exe https://192.168.x.x root mypassword | Caught Exception : Name : UriFormatException Message : Invalid URI: The format of the URI could not be determined. |
I am able to connect to the ESXi hose using the vSphere client. What am I doing wrong here?
Initially I thought that it was because I needed vCenter to invoke the web services on the ESXi host, but after reading a few white papers I came to the conclusion that vCenter was not necessary to control the ESXi host with the vSphere SDK.
Also since one of the outputs gave me the usual certificate warning I'm assuming the sample did indeed reach the host and receive a reply, I'm just not sure why the connect was still unsuccessful. Maybe I'm not using the right URL and hence the HTTP 400 I got back. I'm also assuming from the 301 that the host only wants to accept HTTPS connections.
Any pointers would be appreciated.