Advertisement
easternnl

SessionInfo function

Dec 23rd, 2015
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # return information about the current Windows / Citrix session in an object.
  2. function SessionInfo
  3. {
  4.  
  5. $result = New-Object System.Object
  6.  
  7. # collect Computer Information
  8. $result | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value $env:COMPUTERNAME
  9.  
  10. # collect Citrix Information
  11. $registry = (Get-ItemProperty -Path HKLM:\SOFTWARE\Citrix\ICA\Session -ErrorAction SilentlyContinue )
  12.  
  13. $result | Add-Member -MemberType NoteProperty -Name "ClientName" -Value $registry.ClientName
  14. $result | Add-Member -MemberType NoteProperty -Name "ClientAddress" -Value $registry.ClientAddress
  15. $result | Add-Member -MemberType NoteProperty -Name "PublishedName" -Value $registry.PublishedName
  16.  
  17. return $result
  18. }
  19.  
  20. SessionInfo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement