How to monitor process in VMWare Guest (Ubuntu) to prevent Windows 11 Host from sleeping

On Windows 11, I have VMWare Workstation Pro 17. Power settings is to turn dark after every 10 minutes.

I am testing stuff in an Ubuntu VM. When that occurs, I’d like the screen to not go dark and be locked. However, when I’m not testing in the VM, but has the VM powered on, it should lock. Assume in both cases there are no user interaction.

I suppose I could create a script in Ubuntu to simulate a keypress every once in a while? Or have a webhook/service that communicates between guest and host. But ideally it seems more proper to have Windows Host check if tests are happening in a VM.

As mentioned in title. How? Or…whats the best way?

One way I can think of is to have the Windows host run a background process which polls the Ubuntu guest for activity. Or to have the Ubuntu guest periodically inform the Windows host that it’s active.

Basically, if Ubuntu isn’t locked due to inactivity, neither will Windows. At least that’s the idea anyway. You may hit snags when implementing. :wink:

Yup I was thinking something like that.

But was curious if theres something more VMWare-ish. Like via the vmware tools of sorts to get visibility into VMs so that it will be completely a Host-only action.

It depends on your definition of inactivity. Does your guest suspend itself when it’s no longer active? There’s a REST API to check for that.

When your guest goes to sleep (OS-agnostic—nothing custom needs to be run on the guest side), then the virtual machine suspends. On the host, you stop preventing it from sleeping.

Caveat:

Workstation Pro REST API Considerations

Keep the following considerations in mind when using the Workstation Pro REST API.

  • VMware Workstation Pro REST API are available only for Workstation Pro.
  • The Workstation Pro REST API service depends on the vmrest process.
  • The vmrest service runs as the user who starts it.

Thanks alot! Let me see if the Workstation Pro REST API is the right one for me.

Just realise REST API is about the best there can be. No equivalent to a docker log of sorts…