VMware Cloud Community
KThorlund
Enthusiast
Enthusiast

Possible to run code on remote machine?

Hi,

I am able to run code on my VMs via VMWare Tools API, on the VMs available in my VC specified as en endpoint:

var host = vm.sdkConnection;

var guestOperationsManager = host.guestOperationsManager;

var guestAuth = new VcNamePasswordAuthentication();

guestAuth.username = vmUsername;

guestAuth.password = vmPassword;

guestAuth.interactiveSession = false;

I have a second vCenter which is not specified as an endpoint (and which will not be). I would like to connect to a Windows machine on the second VC, but I cant use my above code as I cant "grab" the vm in vRO..

Is it possible in some other way - maybe someone point me to an article or example, maybe even just a small pointer.. Smiley Happy

Regards, K

0 Kudos
2 Replies
eoinbyrne
Expert
Expert

If it's a Windows VM and is accessible over the network you could use PowerShell remoting to get there ? Or maybe psexec running a remote command from a vRO managed VM. You'd have to consider privilege levels etc too though

HTH

0 Kudos
iiliev
VMware Employee
VMware Employee

Do you have PowerShell plug-in configured in your setup? PowerShell can invoke commands on remote Windows machines. There should be some documentation and examples online; for example https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/running-remote-commands?view=po...

The old versions of AD plug-in had support for WMI, but it was removed in the actual versions of the plug-in.

0 Kudos