Solved

vb script does not work in xenapp 6.5

Posted on 2013-06-16
6
1,444 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
  • 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 24

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 24

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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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 24

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

947 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now