Question

How can I execute a PowerShell script inside a guest VM through the host?

  • 9 October 2020
  • 2 replies
  • 795 views

Userlevel 2
Badge +2

Hi all.

I’ve been trying to figure out how I can execute a PowerShell script inside a guest VM, both Linux and Microsoft, on AHV through the host but can’t find any solid information on the topic.

There is a discussion called “Execute Script Inside AHV VM?” but that is only for initial configuration of the VM. I’m looking for a way to execute an arbitrary script on any running VM without having access to the VM through its default network configuration.

It’s basically a hosting situation where customer VMs exist within their own isolated environments and I’m responsible for running various scripts for - among other things - joining new servers to AD, installing SQL Server, patching the OS, etc, etc.

Looking at this post there seems to be a way to run scripts through NGT but when reading the Nutanix Bible that option seems to be limited to VM creation or cloning.

Any workaround I can come up with doesn’t scale well when we reach thousands of VM’s and hundreds of customers. 

Is there a way to do this or do we have to switch hypervisor, something we really, really don’t want to do?

Thanks.


This topic has been closed for comments

2 replies

Userlevel 2
Badge +3

Unfortunately I have not found a way to do this with Nutanix AHV.  VMware has the Invoke-VMScript which works through the VMware Tools.  I have not found similar functionality with Nutanix.  I’ve only done it using networked remote access methods.

 

If you find something, please post here for others to benefit.

 

-TimG

Userlevel 2
Badge +2

As I feared.

Ok, we might be able to use an agent-based method as we need to install a management agent anyhow.

Thanks for the quick reply, and if I do discover a method, I’ll be sure to share it.