ThinWorld Citrix Knowledgebase

Tuesday, 9 February 2010

MFCOM Script to detect CAG Access

I wanted a script to detect if a users connection was made through CAG (Citrix Access Gateway)

I required this as i wanted to save users default printer only when the connection was made in the office. This is to prevent users saving their home printer information into their profiles.

We use a hybrid profile solution managed by Appsense Environment Manager. Using the following script as a custom rule in Appsense we could tell Appsense to NOT SAVE the default printer for any connections made through the CAG.


Script
'Name of Filter scan expected to pass
ExpectedFilter = "xxx_CWI_Policy"

'Get Server Name
Set objNTInfo = CreateObject("WinNTSystemInfo")
ServerName = lcase(objNTInfo.ComputerName)

Result = 0

'Create MetaFrame Session Object
Set MFSession = Createobject("MetaFrameCOM.MetaFrameSession")

'Initialize the session object with our data
MFSession.Initialize 6, ServerName ,"",-1

'Iterate through the session filters for this session

For Each x in MFSession.SmartAccessFilters
msgbox x
' return true if our filter is found
If x = ExpectedFilter Then
Result = 1
End If
Next
'Return result of script
If Result = 0 Then
'Rule will pass
WScript.Quit 0
Else
'Rule will fail
WScript.Quit 1
End If

Labels:

Monday, 7 December 2009

MFCOM To List Servers Silo

A collague asked me for a script to list all the servers and their assigned silo into a text file so he can put the information into a change control.

Here's the script.

StrOutputfilename = "server_silo.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set Output_File = fso.CreateTextFile(stroutputFileName, True)

Set farm=CreateObject("MetaframeCOM.MetaframeFarm")
farm.initialize 1

for each server in farm.servers
Output_File.Writeline server.Servername & " " & server.ParentFolderDN
Next

Outputfile.Close

Labels:

Monday, 21 September 2009

Find Server Location in Farm MFCOM VBS Script

This script searches the Farm for a given server name and outputs its Location with the AMC console. This can be a handy script to quickly find the silo name of problem server and saves performing the search in the CMC.

strMessage = " Identify a Citrix Server"
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Exec("MFREG.exe Servername")
srch_Server = UCase(InputBox(strMessage, "Enter Server to Check "))
Set farm=CreateObject("MetaframeCOM.MetaframeFarm")
farm.initialize 1

for each server in farm.servers
if server.ServerName = Srch_Server then
wscript.echo Server.serverName & " - " & Server.IPAddress & " - " & Server.ParentFolderDN
wscript.quit
end if
Next
wscript.echo "Server Not Found"
Wscript.Quit

Labels:

Tuesday, 21 July 2009

Generate list of applications in the farm

Citrix provides a handy tool to export and import all the applications in a farm.
The tool is called FARMAppUtil

It been around for ages but still works on XenApp 4.5 and XenApp 5.0

The ZIP file from citrix needs to extacted onto a local Drive as it doesnt seem to work when run from a network drive.

FarmAppUtil S (note uppercase S) - This will export the apps to a file
FarmAppUtil - This imports applications

Download the ZIP file from
http://support.citrix.com/article/CTX107934

Labels: