Solved

vb script does not work in xenapp 6.5

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
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…

820 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