VMware Cloud Community
assafk
Contributor
Contributor

working with Guest User Mapping to run commands over guest OS

Hi All

i am trying to understand how can i run commands over a Guest Os using VMware SDK

here is the working code for running a command using VMware SDK ( in c#)

var processMgr = new ManagedObjectReference { type = "GuestProcessManager", Value = "guestOperationsProcessManager" };

var auth = new NamePasswordAuthentication { username = @"theGuestOsUser", password = "TheGuesOsPassword", interactiveSession = false };

var progSpec = new GuestProgramSpec { programPath = @"C:\Windows\System32\ipconfig.exe", arguments = "" };

var vmRef = new ManagedObjectReference { type = "VirtualMachine", Value = "vm-164" };

var pid = vimService.StartProgramInGuest(processMgr, vmRef, auth, progSpec);

as i could understand to be able to run commands on the VM with different SSO user

i need to go the Guest User Section and add the relevant SSO user

as you could see i've added: local user(root) / domain user (administrator)

pastedImage_0.png

as describe in the documentation

Configuring User Mappings on Guest Operating Systems

You must configure VMs to accept X.509 certificates. X.509 certificates allow the vSphere administrators in your data center to use SAML tokens issued by single sign-on service to access guest OSs.

the only related thread i could find is this one

https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_ce...

can anyone explain what does it means to configure vm the accept x.509 certificates?

of at least point me to a thread the explain what needs to be done so this code  will work

var processMgr = new ManagedObjectReference { type = "GuestProcessManager", Value = "guestOperationsProcessManager" };

var auth = new NamePasswordAuthentication { username = @"root@localos", password = "TheSSOPassword", interactiveSession = false };

var progSpec = new GuestProgramSpec { programPath = @"C:\Windows\System32\ipconfig.exe", arguments = "" };

var vmRef = new ManagedObjectReference { type = "VirtualMachine", Value = "vm-164" };

var pid = vimService.StartProgramInGuest(processMgr, vmRef, auth, progSpec);

thanks

Tags (1)
Reply
0 Kudos
0 Replies