[Solved] Detect if running headless

Discussions about using Windows guests in VirtualBox.
Post Reply
luuk
Posts: 3
Joined: 25. Jun 2018, 00:30

[Solved] Detect if running headless

Post by luuk »

Hi,

I am running a few Windows guest in headless mode (as build machines). I basically launch them from a Linux host in headless mode. A startup script on the Windows machines subsequently performs the app build. Question is; is there a way to detect on the Windows guest, if the guest has been started in headless mode vs normal mode?

I need to determine this as I need to perform an action within the script based on the mode I started the guest in.

Cheerio,
Luuk
Last edited by socratis on 26. Jun 2018, 01:53, edited 1 time in total.
Reason: Marked as [Solved].
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Detect if running headless

Post by socratis »

That's an interesting question. And the answer might be to parse the output of:
  • 
    VBoxManage showvminfo "<YourVM>"
Compare the outputs for a normal vs. a headless start:
(Starting "normal")
...
Session name:    GUI/Qt

(Starting "headless")
...
Session name:    headless
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
luuk
Posts: 3
Joined: 25. Jun 2018, 00:30

Re: Detect if running headless

Post by luuk »

That assumes the 'VboxManage' command is available on the Windows guest. Which I believe it isn't.

The only command one might have avail on the Windows guest, through the guest additions ISO is vboxcontrol.exe. The latter doesn't provide any useful options to interogate what I need from the VM. Well I couldn't find any :(
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Detect if running headless

Post by socratis »

Oh, you want to know from the guest side, sorry...
You can set a property for the guest, if the guest has Guest Additions installed. See 4.7 Guest properties. If not, a shared file (like a flag) on a shared network location.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
luuk
Posts: 3
Joined: 25. Jun 2018, 00:30

Re: Detect if running headless

Post by luuk »

Thanks, that might work indeed :)

I thought there would be a more straight forward way to get that info. But hey I should be able to get it to work that way.

Thanks again,
Luuk
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Detect if running headless

Post by socratis »

Glad to have helped. Marking as [Solved].
You're right though, the VBoxControl within the guest could be expanded to include all the information of the "VBoxManage showvminfo" from the host...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply