Here is an example which enumerates applications, which are published via Citrix. It worked many years but a while ago I had to deactivate the user and group enumeration (with if 0 clauses), because they lead to an uncatchable application crash (runtime requested termination).
Perhaps someone could help narrow this down?
# siehe auch: http://forums.citrix.com/thread.jspa?threadID=102245 proc citrixEnumApps_ {} { # momentan keine expliziten Fehlerabfangungen, keine args set farm [::tcom::ref createobject "MetaFrameCOM.MetaFrameFarm"] $farm Initialize 1 set allApps [list ] ::tcom::foreach app [$farm Applications] { $app LoadData 1 set srvr [list ] set thisApp [list [$app DistinguishedName]] if {[$app AppType] == 3} { # MetaFrameWinAppObject set appObj [$app WinAppObject] if {[$appObj PNAttributes] & 8} { # MFWinAppDesktop lappend thisApp "(published Desktop)" } else { lappend thisApp [$appObj DefaultInitProg] } ::tcom::foreach srv [$app Servers] { lappend srvr [$srv ServerName] } set srvr [lsort $srvr]; # 15.10.2008 } elseif {[$app AppType] == 17} { # MetaFrameContentObject set appObj [$app ContentObject] lappend thisApp [$appObj ContentAddress] } set grps [list ] if 0 { ::tcom::foreach grp [$app Groups] { lappend grps [$grp GroupName] } set grps [lsort $grps]; # 15.10.2008 } set user [list ] if 0 { ::tcom::foreach usr [$app Users] { lappend user [$usr UserName] } set user [lsort $user]; # 15.10.2008 } lappend thisApp $grps $user $srvr lappend allApps $thisApp } return $allApps }
Since this script didn't work anymore either, I think it has nothing to do with tcl at all...
'**************************************************************************** ' 'pubAppRpt.vbs ' 'Description: Write to the cmd session a list of all published apps and the ' users and groups assigned to them. ' 'Usage: e.g. >cscript pubAppRpt.vbs ' '**************************************************************************** Dim mfFarm Dim mfApp Dim mfGrp Dim mfUsr Set mfFarm = CreateObject("MetaFrameCOM.MetaFrameFarm") mfFarm.Initialize 1 For Each mfApp In mfFarm.Applications mfApp.LoadData 1 WScript.Echo "Published Application - " & mfApp.Appname WScript.Echo " Groups" For Each mfGrp In mfApp.Groups WScript.Echo " " & mfGrp.GroupName Next WScript.Echo WScript.Echo " Users" For Each mfUsr In mfApp.Users WScript.Echo " " & mfUsr.UserName Next WScript.Echo Next
gives:
U:\eigene>cscript pubAppRpt.vbs Microsoft (R) Windows Script Host, Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. Alle Rechte vorbehalten. Published Application - KHC Groups U:\eigene\pubAppRpt.vbs(25, 9) (null): Unbekannter Fehler
See: