Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

c# - StartProgramInGuest

$
0
0

Hi,

 

I'm very confused with VI API, I'm trying to set a startprogram in guest and I got stuck with diffrent object types, Can somebody please have a look on that.:

 

 

List<VirtualMachine> lstVirtualMachines = new List<VirtualMachine>();
            NameValueCollection vmFilter = new NameValueCollection();
            ManagedObjectReference DcMoRef = new ManagedObjectReference();
            GuestOperationsManager guOP = new GuestOperationsManager(vimClient, DcMoRef);
         
            NamePasswordAuthentication auth = new NamePasswordAuthentication();
            auth.Username = "xyz";
            auth.Password = "abc";
            auth.InteractiveSession = true;
            GuestProgramSpec progSpec = new GuestProgramSpec();
            progSpec.ProgramPath = "C:\\WINDOWS\\NOTEPAD.EXE";
            progSpec.Arguments = "";
            GuestProcessManager GuPr = new GuestProcessManager(vimClient, DcMoRef);
           VirtualMachine virtualmachine = (VirtualMachine)vimClient.FindEntityView(typeof(VirtualMachine), DcMoRef, vmFilter, null);
           long poid = GuPr.StartProgramInGuest(DcMoRef, auth, progSpec);

 

I'm not sure where I doing wrong , Can somebody help me please.

 

Thanks


Viewing all articles
Browse latest Browse all 1860

Trending Articles



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