Get the ClientAddress (IP) under Citrix
garak
Member Posts: 3,263
When you are working under citrix and you need the clientaddress of the connected users (the local IPs of the connected Client Pcs) you can do this with 2 Options:
1. You use the 'Citrix MetaFrame COM Library'
This example shows all session and the connected Clientaddress, Clientname and Usernames
Variables
The Problem here is, to run the code, you must be an Citrix Admin
An other way is to use the "WTSManager.dll"
Regards
1. You use the 'Citrix MetaFrame COM Library'
This example shows all session and the connected Clientaddress, Clientname and Usernames
Variables
Name DataType Subtype Length
MetaFrameFarm Automation 'Citrix MetaFrame COM Library'.MetaFrameFarm
MetaFrameWinFarm Automation 'Citrix MetaFrame COM Library'.IMetaFrameWinFarm6
IMetaFrameSessions Automation 'Citrix MetaFrame COM Library'.IMetaFrameSessions
IMetaFrameSession Automation 'Citrix MetaFrame COM Library'.IMetaFrameSession
SessionCounts Integer
i Integer
IF ISCLEAR(MetaFrameFarm) THEN
CREATE(MetaFrameFarm);
MetaFrameFarm.Initialize(1);
MetaFrameWinFarm := MetaFrameFarm.WinFarmObject;
if MetaFrameWinFarm.IsCitrixAdministrator = 0 then
error('Not an Citrix Admin ;-(');
IMetaFrameSessions := MetaFrameFarm.Sessions;
SessionCounts := IMetaFrameSessions.Count();
MESSAGE(FORMAT(SessionCounts));
FOR i := 0 TO SessionCounts-1 DO BEGIN
IMetaFrameSession := IMetaFrameSessions.Item(i);
MESSAGE('USER %1\ClientName %2\ClientAddress %3',
IMetaFrameSession.UserName,
IMetaFrameSession.ClientName,
IMetaFrameSession.ClientAddress);
END;
clear(MetaFrameFarm);
The Problem here is, to run the code, you must be an Citrix Admin
An other way is to use the "WTSManager.dll"
variables
Name DataType Subtype Length
WTSManager Automation 'WTSManager Library'.Shell
Counts Integer
i Integer
IP Variant
ClientName Variant
IF ISCLEAR(WTSManager) THEN
CREATE(WTSManager);
Counts := WTSManagerP.ClientCount;
FOR i := 1 TO Counts DO BEGIN
WTSManager.Refresh();
IP := WTSManager.Clients(i).IPAddress;
WTSManager.Refresh();
ClientName := WTSManager.Clients(i).ClientName;
IF (FORMAT(IP) <> '') THEN BEGIN
MESSAGE('IP = %1\Clientname = %2',IP,ClientName);
//LogOnUsers.INIT;
//LogOnUsers."Report ID" := i;
//LogOnUsers."Client IP" := IP;
//LogOnUsers."Client Name" := ClientName;
//LogOnUsers.INSERT;
END;
END;
CLEAR(WTSManager);
Regards
Do you make it right, it works too!
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 327 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions