VMware Horizon Community
lbnl2014
Contributor
Contributor
Jump to solution

How to get hostname of the physical PC inside a virtual machine before user logs in Windows?

I am not sure if this is the right place to post this question, I am developing a software to support VMWare PCoIP and need to find out how to get the hostname of the physical machine (that runs View Client and the virtual machine) inside a virtual machine before the user logs in Windows of the virtual machine.

I understand there are two ways to read the hostname, via environment variables and registry under HKEY_CURRENT_USER\Volatile Environment, but they are only available after the user has logged on. I need the info before the user logs in.

Is there any VMware API that can be called or queried the hostname?

Thanks.

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
mpryor
Commander
Commander
Jump to solution

Not on the broker, but there's the Start Session scripts on the VM itself: http://pubs.vmware.com/view-52/topic/com.vmware.view.integration.doc/view_integration_startsession_s...

Note that these get executed when a desktop VM has allocated the connection, not at the point the client connects - it is possible for the client to fail to complete the connection (crash, cancel, network failure), and so any solution you design needs to handle that.

Mike

View solution in original post

Reply
0 Kudos
4 Replies
Linjo
Leadership
Leadership
Jump to solution

Have you tried to read the eventlog? Its a sql-database where all actions are logged.

// Linjo

Best regards, Linjo Please follow me on twitter: @viewgeek If you find this information useful, please award points for "correct" or "helpful".
Reply
0 Kudos
mpryor
Commander
Commander
Jump to solution

Not on the broker, but there's the Start Session scripts on the VM itself: http://pubs.vmware.com/view-52/topic/com.vmware.view.integration.doc/view_integration_startsession_s...

Note that these get executed when a desktop VM has allocated the connection, not at the point the client connects - it is possible for the client to fail to complete the connection (crash, cancel, network failure), and so any solution you design needs to handle that.

Mike

Reply
0 Kudos
lbnl2014
Contributor
Contributor
Jump to solution

Thanks for the replies.

I have checked the event logs, but cannot find any info.

I have also tried Mike's suggestion, I followed every steps mentioned in the link to enable start session script (enable the VM service, create a script file as given in the link, and set registry settings, etc.) but then was not able to connect to the virtual desktop anymore. As soon as I disable the script by setting RunScriptsOnStartSession to 0, I manage to (re-)connect to my virtual desktop. I wonder how can I debug this kind of problems?


Any suggestion would be grateful, thanks.

Reply
0 Kudos
lbnl2014
Contributor
Contributor
Jump to solution

Have fixed the problem mentioned earlier, the script now runs fine and gives me what I need.

Thanks

Reply
0 Kudos