Solved

vb script does not work in xenapp 6.5

Posted on 2013-06-16
6
1,484 Views
Last Modified: 2013-07-17
This vb script is used to create a list of users logged into a Citrix 4.5 MetaFrame farm.  We are migrating to XenApp 6.5 and the script does not work.  It does not error, it just does not return any data.  Here is the info the script returns: <user>; <server>; <workstation>;  <published app>; <ip address>;  <connection>.  An example of the results is shown below.

Sun 06/16/2013    5:48:23.97  CITRIX4  
user15      CITRIX7      WKS2748      Pub Desktop 1      192.168.1.18      ICA-tcp#1
user16      CITRIX3      WKS2653      Pub Desktop 1      192.168.1.12      ICA-tcp#1
user17      CITRIX8      WKS2652      Pub Desktop 1      192.168.1.11      ICA-tcp#2
Active Session Count = 3
Total Session Count = 3
On Error Resume Next
Const cMetaFrameWinFarmObject = 1
Const MFSessionStateActive = 1
Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
theFarm.Initialize(cMetaFrameWinFarmObject)
intSessionCount = 0
intActiveCount = 0
For Each oSession In theFarm.Sessions
  intSessionCount = intSessionCount + 1
    If (oSession.SessionState = MFSessionStateActive) and (oSession.SessionName <> "Console") Then
        intActiveCount = intActiveCount + 1
          If isnull(oSession.ClientAddress) or oSession.ClientAddress = ""  then
             WScript.Echo oSession.UserName & vbTab & vbTab & oSession.ServerName & vbTab & vbTab & oSession.ClientName & vbTab & vbTab & oSession.AppName & vbTab & oSession.SessionName 
          Else      
             WScript.Echo oSession.UserName & vbTab & vbTab & oSession.ServerName & vbTab & vbTab & oSession.ClientName & vbTab & vbTab & oSession.AppName & vbTab & vbTab & oSession.ClientAddress & vbTab & vbTab & oSession.SessionName 
          End If
  End If
Next
WScript.Echo "Total Session Count = " & intSessionCount & vbcrlf & "Active Session Count = " & intActiveCount

Open in new window

0
Comment
Question by:epmmis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 39251169
I believe I have something like this in powershell...would you be interested in that?
Otherwise, remove the "On Error" statement at the top so you can see where it's failing...
0
 
LVL 25

Expert Comment

by:Coralon
ID: 39252510
You will definitely want to convert to powershell for XA 6.5.  

This one should get what you need, although my results on the client IP address are mixed..

add-pssnapin citrix* -erroraction silentlycontinue
write-host (get-date) $env:computername
get-xasession -farm | select-object -property AccountName,MachineName,ClientName,BrowserName,ClientIP4,SessionName | format-table

Open in new window


That's pretty close to the output you had.. Getting those last couple of lines would be trickier.  

Coralon
0
 
LVL 25

Accepted Solution

by:
Coralon earned 500 total points
ID: 39252652
Minor syntax correction :-)

add-pssnapin citrix* -erroraction silentlycontinue
write-host (get-date) $env:computername
get-xasession -farm | select-object -property AccountName,ServerName,ClientName,BrowserName,ClientIP4,SessionName | format-table

Open in new window


Coralon
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:epmmis
ID: 39261070
This is a fantastic start.  Here is a sample output.  The IP would be nice, but I can live without if it is seriously complicated to retriever.  

AccountName   ServerName    ClientName   BrowserName  ClientIP4    SessionName
DOM\User1      WINCTX02         PC12345          Pub Desktop                            ICA-TCP#0  
DOM\User1      WINCTX03         PC12345          Pub Desktop                            ICA-TCP#0  
DOM\User2      WINCTX01         PC54321                                                              ICA-TCP#0

What other properties are available in the get-xasession -farm object?

Please excuse my delay but today was go live day.

Is there a way to get the total number users on the farm?
0
 
LVL 25

Expert Comment

by:Coralon
ID: 39261248
I believe you can the total number of users, but I'm not sure how to get it.. I'm still learning powershell :-)

But, if you want to see what is available, that's very easy.
get-xasession -farm | get-member

Open in new window


Coralon
0
 

Author Closing Comment

by:epmmis
ID: 39335216
The script provides the information I need.
Thanks
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

#Citrix #XenApp #Citrix Scout #Citrix Insight Services #Microsoft VMMAP #Microsoft ADEXPLORE #Microsoft RAMMAP #Microsoft TCPVIEW #Microsoft AUTORUNS #Microsoft PROCESS EXPLORER #Microsoft PROCESS MONITOR
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question