Last week our Desktop Team asked me question how we can get information about which ThinClient user is login from. Sounds like good idea for script or function.
After research I found that View Agent writing some information to Windows Registry which include info about ThinClient device as Name, IP Address, Connection Server and so on. This information are written under HKCU\Volatile Environment and HKU\User SID\Volatile Environment, my function retrieving information from the second one. First to be able to read Registry key we need to start Remote Registry service. Next using reg query command I read Registry entry under HKEY_Users to look fo SID of logon user. Next it reads Voltaire Environment and look for key with value ViewClient_Machine_Name which contain data with ThinClient name from which user is login.
I have created simple function to retrieve ThinClient name and print it to screen:
<# .SYNOPSIS A brief description of the Get-ThinClient function. Function to retrieve information about Thinclient name from which user login to Horizon View VDI .DESCRIPTION A description of the file. .PARAMETER Computer A description of the Computer parameter. Use full Horizon View VDI Computer name. .EXAMPLE PS C:\> Get-ThinClient -Computer 'Value1' Tky2 Sebastian Two logon from EXAMWIN08 .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.123 Created on: 8/8/2016 11:34 AM Created by: Sebastian Organization: Filename: =========================================================================== #> Function Get-ThinClient { [Cmdletbinding()] Param ( [String[]]$Computer ) Foreach($VDI in $Computer){ try { Get-Service -ComputerName $VDI RemoteRegistry | Start-Service $RegUser = reg query "\\$VDI\hku" $Key = ($RegUser.get(4)).replace('HKEY_USERS\', '') if ($Key.Length -ge 9) { $RegInfo = reg query "\\$VDI\HKU\$Key\Volatile Environment" $UN = $RegInfo -cmatch "USERNAME" $UserName = $UN.Replace(" USERNAME REG_SZ ","") $tc = $RegInfo -cmatch "ViewClient_Machine_Name" $ThinClient = $tc.replace(" ViewClient_Machine_Name REG_SZ ","") Write-Output "$UserName logon from $ThinClient to VDI $VDI" } else{ Write-Output "$VDI no user Logon" } } catch{} } } # Function End
Hope someone will find this helpful, my Desktop team did.
Hi, Sebastian.
Where is this script ( Get-thinclient ) goes ?
CS server? or VDI (Agent)?
LikeLike
Hi,Where is this script goes from?
CS server or VDI (Agent)?
LikeLike
Hello, you run this against machine where is the View Horizon Client installed.
LikeLike