Many times we hurdle on how to enable http at ESXi Servers as they are COSless and one need to update the "proxy.xml" to enable HTTP. Here are the easy steps to upload the updated proxy.xml.

Follow the below mentioned steps:

1. Download the proxy.xml from https://<hostname>/host, save a local copy.
Note: Do not rename the file.
2. Use a text editor to open the downloaded proxy.xml file.
3. Navigate to the list of endpoints in the file (identified by the <EndpointList> tag) that contains settings for the Web service supporting the SDK. The nested tags may look something like this:
...
<e id="1">
<_type>vim.ProxyService.NamedPipeServiceSpec</_type>
<accessMode>httpsWithRedirect</accessMode>
<pipeName>/var/run/vmware/proxy-sdk</pipeName>
<serverNamespace>/sdk</serverNamespace>
</e>
...
4. Change the accessMode to httpAndHttps. Alternatively, to completely disable HTTPS, you can set it to httpOnly.
5. Save your settings and close the file.
6. Upload the updated file using httpFileAccess mechanism. Please refer below C# code snippet to upload the file.

Cookie cookie = _service.CookieContainer.GetCookies(new Uri(url))[0];
String cookieString = cookie.ToString();
String httpUrl = "https://" + <hostname> + "/host/proxy.xml";
httpUrl = httpUrl.Replace("\\ ", "%20");
Console.WriteLine("Putting VM File " + httpUrl);
WebClient client = new WebClient();
NetworkCredential nwCred = new NetworkCredential();
nwCred.UserName = username;
nwCred.Password = password;
client.Credentials = nwCred;
client.Headers.Add(HttpRequestHeader.Cookie, cookieString);
client.UploadFile(httpUrl, "PUT", localpath);

Note: You need to first login using VI APIs, steal a cookie from an active session.

7. Restart the hostd management services using DCUI.

Have you ever felt a need to fetch some information from the guestOS that is not exposed by VI APIs? If you have a requirement to pass some information from guestOS and use VI APIs to get access to that information, VMware tools guest service can be of help.

When you install VMware Tools in a virtual machine, the VMware guest operating system service is one of the primary components installed. In a Linux guest, the guest service is called "vmware-guestd" and in a Windows guest, the guest service program file is called VMwareService.exe. One can use this service to set a guest info variable.

The command to set the guest variables is:

In windows guest:
VMwareService --cmd "info-set guestinfo.<variableName> <value>"

In Linux guest:
vmware-guestd --cmd "info-set guestinfo.<variableName> <value>"

This value can then be retrieved using VI APIs through the config.extraConfig["guestinfo.<variableName>"] property for the virtual machine object.

As mentioned above, the primary pre-requisite of above method is to have VMware Tools installed.



Copyright 2009 InterraIT template by Blogcrowds.