Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 179681

GuestProcessManager C#

$
0
0

Hi, I tested WebService SDK 5.1.0 , but it didn't work.

The code is below.   I think  GuestProcessManager TYPE and VALUE is wrong.

I can't find the TYPE and VALUE character string in any resource.

(The character string in the below code is copied from JAVA code.)

In JAVA the GuestProcessManager CLASS exist , but in C#  I could not found that.

Please teach me the TYPE and VALUE caracter string or other any cause.

 

 

    public void displayNewProperties() {
            _service = ecb.getServiceConnectionV25().Service;
            _sic = ecb.getServiceConnectionV25().ServiceContent;
            String vmName = ecb.get_option("vmname");
            ManagedObjectReference vmmor = ecb.getServiceUtilV25().GetDecendentMoRef(null,
                                             "VirtualMachine", vmName);

            if (_sic.guestOperationsManager != null && vmmor.type == "VirtualMachine")
            {

                NamePasswordAuthentication nAuth = new NamePasswordAuthentication();
                nAuth.username = "ad\\administrator";
                nAuth.password = "passwordxxxxx";
                nAuth.interactiveSession = false;

                ManagedObjectReference prRef = new ManagedObjectReference();
                prRef.type = "GuestProcessManager";
                prRef.Value = "guestOperationsProcessManager";
               

                long[] pids = new long[] {};

                    GuestProcessInfo[] intervals
                        = ecb.getServiceConnectionV25()._service.ListProcessesInGuest(prRef,vmmor ,nAuth , null);

        foreach(GuestProcessInfo gpi in intervals )   {
                        Console.WriteLine(gpi.owner.ToString() + "," + gpi.pid.ToString() + "," + gpi.cmdLine.ToString());
                    }


            }
                if (vmmor != null)
                {
                ArrayList supportedVersions = VersionUtil.getSupportedVersions(ecb.get_option("url"));

                Object[] vmProps = getProperties(vmmor, new String[] { "name" });
                String serverName = (String)vmProps[0];
                Console.WriteLine("Virtual Machine Name " + serverName);

                vmProps = getProperties(vmmor, new String[] { "config.uuid" });
                String uuid = (String)vmProps[0];
                Console.WriteLine("Config UUID " + uuid);

                vmProps = getProperties(vmmor, new String[] { "config.guestId" });
                String guestId = (String)vmProps[0];
                Console.WriteLine("Guest Id " + guestId);

                if (VersionUtil.isApiVersionSupported(supportedVersions, "2.5"))
                {
                    vmProps = getProperties(vmmor, new String[] { "name" });
                   
                    Boolean bootOptionsSupported = (Boolean)getObjectProperty(vmmor, "capability.bootOptionsSupported");
                    Console.WriteLine("Boot Options Supported " + bootOptionsSupported);

                    Boolean diskSharesSupported = (Boolean)getObjectProperty(vmmor, "capability.diskSharesSupported");
                    Console.WriteLine("Disk Shares Supported " + diskSharesSupported);

                    Boolean flag = VersionUtil.isApiVersionSupported(supportedVersions, "4.0");
                    Console.WriteLine("Is API Supported  " + flag);
                    if (flag)
                    {
                        Console.WriteLine("\nProperties added in vSphere API 4.0\n");
                        Boolean changeTrackingSupported = (Boolean)getObjectProperty(vmmor, "capability.changeTrackingSupported");
                        Console.WriteLine("Change Tracking Supported " + changeTrackingSupported);

                        Boolean recordReplaySupported = (Boolean)getObjectProperty(vmmor, "capability.recordReplaySupported");
                        Console.WriteLine("Record Replay Supported " + recordReplaySupported);

                        VirtualMachineFaultToleranceState faultToleranceState
                           = (VirtualMachineFaultToleranceState)getObjectProperty(vmmor, "runtime.faultToleranceState");
                        Console.WriteLine("Fault Tolerance State " + faultToleranceState);
                    }
                }
            }
            else
            {
                Console.WriteLine("Virtal Machine Not Found");
            }
        }

 

 

Below is Result message.

 

[ 2013/06/05 16:29:51 ] Begin Log.
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.


Failure : The object has already been deleted or has not been completely created

Press enter to exit.


Viewing all articles
Browse latest Browse all 179681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>