Run a script inside guest OS from host
-
Is it possible to initiate scripts from xcp-ng to run inside guest OS?
I am essentially looking for the xcp-ng/xoa equivalent of
Invoke-VMScript
-
Hi,
I'm not sure about your real use case/functional requirement, but my first answer will be to check Cloudinit first (XO is compatible with it)
-
@olivierlambert I mostly deal with Windows VMs and my automation is mostly based on PowerShell. There are some PowerShell commands that only work when run locally in the VM. I am looking for a way to initiate those commands at the host level. VMWare has that capability via the
Invoke-VMScript
cmdlet, so I was wondering if xcp-ng has a similar capabilityI looked a little bit into cloudinit and and that seemed to be mostly around Linux guests
-
I think there's a support in Windows for cloud init (I remember users doing that in this forum).
Do you need automation at VM creation or later in the life of the VM?
-
@olivierlambert Later in the life of the VM
-
Okay so it's something else, I don't think XenStore is meant for that, you would probably need something more complex for security reasons (like Qrexec which is not available in XCP-ng but in QubesOS)
There's no mechanism in the Windows world to do things like you can do in Linux? (like relying on SSH to access the machine and do whatever you want remotely?)
-
@olivierlambert said in Run a script inside guest OS from host:
There's no mechanism in the Windows world to do things like you can do in Linux?
You can enable an ssh server in Windows Desktop and Server. It works just like Linux.
https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui -
@ajpri1998 What about using something like
psexec
or
the powershell commandInvoke-Command
? -
@Danp said in Run a script inside guest OS from host:
@ajpri1998 What about using something like
psexec
or
the powershell commandInvoke-Command
?Exactly what I was going to recommend, but the request is to be sent from XCP-ng (the hypervisor) rather than some management server..
What would the Windows PowerShell command be doing within the VM, that resides on XCP-ng?
and
Why does the hypervisor need to issue the command to the VM?
-
@DustinB I need to run Install-ADServiceAccount to install service accounts in VMs. This cmdlet unfortunately cannot be run remotely from a management server, or at least I haven't found a way to do so reliably
-
@Virtual said in Run a script inside guest OS from host:
@DustinB I need to run Install-ADServiceAccount to install service accounts in VMs. This cmdlet unfortunately cannot be run remotely from a management server, or at least I haven't found a way to do so reliably
But XCP-ng won't be able to do this either, it sounds like you need an RMM to assist with some of your workloads and are looking at the wrong portion of your technology stack.
-
XCP-ng nor Xen Orchestra can run things within the confines of a VM, they act on the Virtual Hardware that are a portion of the VM.
Everything that happens after the OS loaded (and within the Console for simplicity) are a function of the Operating System and the tools you have installed within it.
-
@DustinB Yeah but VMWare has a functionality that can initiate a command which runs locally in the guest OS
So I was wondering if xcp-ng has a similar functionality
-
And the short answer is not at the moment
-
@olivierlambert Is something like this planned in the future?
-
It's possible that we re-use the system from QubesOS. But it's mostly the demand that will drive the effort. Since there's already something well designed, it's all about integration and use cases. So I'm not against it at all, I hope we'll grow enough to be able to tackle all the topics we have in the backlog
-
@olivierlambert Not sure what Vates' marketing budget is like, but have you considered doing sponsored spots with big tech YouTubers like Linus Tech Tips? That will surely help get more traction for the great product that is xcp-ng.
-
In fact, LTT (via Floatplane) is already an XCP-ng/XO customer
But yeah, it's also a question of the target audience and such. Be certain that we do our max to get that growth, I'd be happy to do that feature as soon as I can
-
@olivierlambert Much appreciated
-
That's quite amazing. I hear them talk about in-office about using Proxmox for VMs, but NEVER about XCP-ng/XO.