11-Jun-2010
Posted by : Stephane THIRION
Category : Citrix, Microsoft, Windows 2003, Windows 2008, XenApp
Tags: eventlog, excel, export, parser, vbscript, wmi, XenApp
Today my need was very simple, I needed to build a script to collect logs in application event log on many XenApp servers. The goal with the following script it to use MFCom to get the target XenApp server list and export everything from the last 7 days and a specific keyword to an Excel file. This is very far to be perfect but it works and it did the job I needed
Let’s share !
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Path and name of the Excel file
FileExport = "d:\temp\yourfile.xls"
'Name of your management Server (Must have MFCOM SDK if not a XenApp Server
CtxFarms = Array("XenappManagementserver.domain.inc")
'Folder in the XenApp Management Console, must begin with Servers/ ex : Servers/APPLICATION1
TargetPool = "Servers/ApplicatioForlder"
If (objFSO.FileExists(FileExport)) Then
objFSO.DeleteFile(FileExport)
End If
Const CONVERT_TO_LOCAL_TIME = False
Set dtmStartDate = CreateObject("WbemScripting.SWbemDateTime")
Set dtmEndDate = CreateObject("WbemScripting.SWbemDateTime")
DateToCheck = CDate(Date)
'Number of day back to check here 7
dtmStartDate.SetVarDate DateToCheck - 7, CONVERT_TO_LOCAL_TIME
dtmEndDate.SetVarDate DateToCheck, CONVERT_TO_LOCAL_TIME
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add
Set objRange = objExcel.Range("A1","Z1")
objRange.Font.Size = 12
objRange.Font.Bold = True
objExcel.Cells(1, 1).Value = "Server"
objExcel.Cells(1, 2).Value = "Event Source"
objExcel.Cells(1, 3).Value = "Event Type"
objExcel.Cells(1, 4).Value = "Event ID"
objExcel.Cells(1, 5).Value = "Event Message"
objExcel.Cells(1, 6).Value = "Event Date"
lign = 2
For i = 0 To UBound(CtxFarms)
Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm", "\\" & CtxFarms(i))
theFarm.Initialize 1
For Each aServer In theFarm.Servers
If aServer.ParentFolderDN = TargetPool Then
objExcel.Cells(lign, 1).Value = aServer.ServerName
TargetSource = "Application"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & aServer.ServerName & "\root\cimv2")
'This line is to query the Security event log
' Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'Security' and SourceName = '" & TargetSource & "' and Type = 'Error' and TimeGenerated >= '" & dtmStartDate & "' and TimeGenerated < '" & dtmEndDate & "'")
'This line is to query the System event log
' Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and SourceName = '" & TargetSource & "' and Type = 'Error' and TimeGenerated >= '" & dtmStartDate & "' and TimeGenerated < '" & dtmEndDate & "'")
'This line is to query the Application event log
Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'Application' and SourceName = '" & TargetSource & "' and Type = 'Error' and TimeGenerated >= '" & dtmStartDate & "' and TimeGenerated < '" & dtmEndDate & "'")
For Each objEvent in colLoggedEvents
' Change here to find event using a keyword in the main message
MyPos = Instr(1, ucase(objEvent.Message), UCase("KeyWord"))
If MyPos > 0 Then
objExcel.Cells(lign, 1).Value = aServer.ServerName
objExcel.Cells(lign, 2).Value = objEvent.SourceName
objExcel.Cells(lign, 3).Value = objEvent.Type
objExcel.Cells(lign, 4).Value = objEvent.EventCode
objExcel.Cells(lign, 5).Value = objEvent.Message
objExcel.Cells(lign, 6).Value = WMIDateStringToDate(objEvent.TimeGenerated)
lign = lign + 1
End If
Next
End If
Next
Next
objExcel.ActiveWorkbook.SaveAs FileExport
objExcel.Quit
EnvoiMail()
Wscript.Quit
Function WMIDateStringToDate(dtmInstallDate)
WMIDateStringToDate = CDate(Mid(dtmInstallDate, 5, 2) & "/" & Mid(dtmInstallDate, 7, 2) & "/" & Left(dtmInstallDate, 4) _
& " " & Mid (dtmInstallDate, 9, 2) & ":" & Mid(dtmInstallDate, 11, 2) & ":" & Mid(dtmInstallDate, 13, 2))
End Function
Function EnvoiMail()
Const SendUsingPort = 2
' Set the variables used to send the message
SMTPServer = "smtp.server.com"
FromName = "administrator@admin.com"
ToName = "me@admin.com"
' Setup the configuration for the message to use
Set Conf = CreateObject("CDO.Configuration")
With Conf.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = SendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
.Update
End With
'Setup the message
Set Message = CreateObject("CDO.Message")
With Message
Set .Configuration = Conf
'Set email adress, subject And body
.To = ToName
.Subject = "Email Subject"
.TextBody = "Hello World !"
.From = FromName
.AddAttachment FileExport
.Send
End With
End Function
At the end I added a function to send this Excel file by email so I can schedule this check and genrerate this report.
Join the forum discussion on this post
10-Apr-2010
Posted by : Stephane THIRION
Hiding system drives C, D, floppy if there is still one and CDRom seems to be easy but I saw many many time at some customer’s place administrator unable to complete this simple operation. The reason is in most of the case, the administrator doesn’t really know how to manage GPO and what is difference between user and machine GPOs.
First you need to know there is a built-in GPO in Microsoft Windows 2003 / 2008 / R2 with these settings ready to be set.
To set it up, you need to create a new GPO or edit an existing one and find these two GPO bellow as follow :


Join the forum discussion on this post
03-Mar-2010
Posted by : Stephane THIRION
Category : Apple, Citrix, Mac OSx Snow Leopard, Secure Gateway VPX, XenApp 5, XenApp 6, XenApp Plugin, XenServer 5.5
Tags: Apple, CAG, Citrix, Citrix Access Gateway, Error 61, Mac, Mac OSx, SSL, SSL Error 61, XenApp
In this post I explain how I tried to troubleshoot this issue, if you need the solution, go at the end of this post.
My company (Activlan) had to renew our certificate installed on our Citrix Secure Gateway 3.1.3. As you might know, Citrix has issued some virtual appliance and I had to chose between, Citrix Access Gateway 4.6.2 VPX and Netscaller VPX Express (Free !). My choice was to integrate a Citrix Access Gateway (CAG) mainly because we are using other product to manage VPN to all our customers and I wanted to install what I needed, nothing less, nothing more.
So here we go, I got my xva file from MyCitrix account and I just deploy it on our XenServer, very easy, very simple, just some clicks. Once installed and basics configuration set, I had to generate the CSR (Certificate Signing Request) and wait for Verisign to send me the certificate I had to use with the CAG. This was a big adventure and of course I should have read the manual before, and configuration isn’t so easy but I guess when you do it all day long you begin to know everything and I can say now, I know how to troubleshoot a CAG from the client side to the Web Interface.
Join the forum discussion on this post
21-Feb-2010
Posted by : Stephane THIRION
Category : ArchY.net Site, Citrix, Presentation Server 4, Presentation Server 4.5, Windows 2008 R2, XenApp 5, XenApp 6
Tags: Citrix, Microsoft, Tuning Tips, Windows 2008 R2, XenApp
There are many post around to tune Citrix XenApp in many ways and there are even more to tune Microsoft Windows 2008 R2.
I want to begin a new document as we had with Citrix Metaframe 1.8 tuning tips on Microsoft Windows NT4 TSE. This was a great document and very helpfull in many way.
If you have any ideas, agree on what I will write or disagree, I take everything to form a big document available online for everyone.
First I would like to know if we should create a wiki-like to let everyone working on the document and add/change at will, what do you think ?
Which is the best way to realize Citrix XenApp tuning tips
- A wiki where everyone can add/change (69%, 9 Votes)
- A thread on the forum (31%, 4 Votes)
- By email (0%, 0 Votes)
- Another (0%, 0 Votes)
Total Voters: 13

Loading ...
If you choose other please add a comment bellow !
19-Feb-2010
Posted by : Stephane THIRION
Unattended installation is very usefull in large XenApp farm, of course if you’re deploying one server per two month you might not be interessed by this process automation but this is always interresting to know this kind of tips. Scripts bellow are example I use every day in production to install servers, of course its needs to be change and adapt to your own settings and of course if you have some ideas to share, I take it !
This unattended example assume you have only one network card enable, a local XenApp source installation file and IP address type 192.168.3 / 192.168.10 / 192.168.200 / 10.113 / 10.112. This file allow to join an existing farm named CTX_TEST with a datastore hosted on a SQL server. Finally, you need to create one folder per farm inside your XenApp source folder if you are automating multi farm setup.
Join the forum discussion on this post
01-Oct-2009
Posted by : Stephane THIRION
Reference problem post : http://forums.citrix.com/thread.jspa?messageID=1409280
Here is my environment : Windows 2008 SP2 with MUI pack installed and Citrix XenApp 5 with latest hotfixes and Citrix Edgesight XenApp Agent 5.1 . I get this error when I open a console on the XenApp servers and it seems to popup in some user’s session…

Click on read more to continue…
01-Jun-2009
Posted by : Stephane THIRION
Category : Citrix, Green Computing, Presentation Server 4, Presentation Server 4.5, XenApp 5
Tags: Capacity, Citrix, Green Computing, Management, Power, Power and Capacity Management, video, Windows 2003, Windows 2008, XAPCM, XenApp
Here we go, Green Computing is coming ! Now Citrix give us the ability to switch off XenApp servers and switch it on only when the load on the power on server reach a limit. This is very very smart and I think this Power and Capacity Management for XenApp will be a success.

Â
You can watch bellow the video filmed during the Synergy 2009 in Las Vegas :
21-Jan-2009
Posted by : Stephane THIRION
This is a short guide to install with the basic requirements the Citrix Web Interface 5.0.1 on a Windows 2003 R2 / sp2. First you have to install IIS Components from the add/remove program in the control panel. If you don’t know what to install request more information I will post screenshot of component you need to choose. After we need to install Framework 3.5 SP1 from Microsoft. You need to install Microsoft Visual J# Net 2.
From here begin the installation of Citrix Web Interface, first we need to install Web Interface 5.0.1 Access Management Console Extension and then we can begin to deploy the Web Interface installer 5.0.1 and you can watch the installation of the two Citrix components in the video bellow :
(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
29-Nov-2008
Posted by : Stephane THIRION
Category : Citrix, Edgesight 5, Microsoft, Windows 2003
Tags: -2147217900, 2005, 2008, Citrix, database, edgesight, error, nlb, sql server, vmware esx, Windows 2003, XenApp
During my experimental EdgeSight setup, I have to face different error, mostly because everything was not ready or not well configure on my side but it can happen.
I have install two Edgesight web server (Esx nlb) and two SQL Reporting Services server (Esx nlb too) with a database store on a SQL 2005 cluster.
I didn’t had the hand on the setup of the two nlb so things where a bit hard to understand since there is quiet a lot of issue and things to do to enable two VMWare ESX nlb communication. (I’m still working on it, any informations are welcome
)
I will update this post everytime I will have an error, I hope it will help some of you.
- Error : Setup was unable to locate the requiered SQL Server Client Tools. The SQL Server Client Tools can usually be located on the SQL Server installation disk.

You just have to install client components of SQL Server 2005 (or 2008) and RTM first