Try this, it works for me:
Code:
Break ON
$TRUE=NOT 0
$FALSE=NOT $TRUE
$MetaFrameWinFarmObject=1
$MetaFrameWinAppObject=3
$oFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
If @ERROR "ERROR: Cannot create farm object ["+@ERROR+"] "+@SERROR+@CRLF Exit @ERROR EndIf
$oFarm.Initialize($MetaFrameWinFarmObject)
If @ERROR "ERROR: Cannot initialise farm object ["+@ERROR+"] "+@SERROR+@CRLF Exit @ERROR EndIf
If Not $oFarm.WinFarmObject.IsCitrixAdministrator
"You must be a Citrix admin to run this script"+@CRLF
Exit 0
EndIf
"MetaFrame Farm Name: "+$oFarm.FarmName+@CRLF+@CRLF
For Each $oApp In $oFarm.Applications
If @ERROR "ERROR: Cannot enumerate applications ["+@ERROR+"] "+@SERROR+@CRLF Exit @ERROR EndIf
$oApp.LoadData($TRUE)
"DistinguishedName: "+$oApp.DistinguishedName+@CRLF
" AppName: "+$oApp.AppName+@CRLF
" Description: "+$oApp.Description+@CRLF
If $oApp.AppType = $MetaFrameWinAppObject
$oWinApp = $oApp.WinAppObject
" WorkingDir: "+$oWinApp.DefaultWorkDir+@CRLF
" DefaultInitProg: "+$oWinApp.DefaultInitProg+@CRLF
EndIf
@CRLF
Next