#160711 - 2006-04-12 11:52 AM
Get Published application
|
krex
Fresh Scripter
Registered: 2006-03-02
Posts: 39
|
Hi! Could somebody help me out i want all publish application in a citrix farm and i want there location and the groups who have access to the application. Is this a wmi script or is it a MFCOM i should use for that.
If anybody could help me getting startet or just give somekind of idea to get startet.
|
|
Top
|
|
|
|
#160713 - 2006-04-12 12:33 PM
Re: Get Published application
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Here it is. Code:
Break ON $=SetOption("Explicit","ON") $=SetOption("WrapAtEOL","ON") ; Initialise local variables {{{ Dim $oFarm,$oServer,$oApplication Dim $sIni,$sBackupINI,$sApplication,$sApplicationDN,$sBackup DIM $METAFRAMEWINAPPOBJECT $sIni=".\PublishedApps.ini" $sBackupIni=".\PublishedAppsHistory.ini" $METAFRAMEWINAPPOBJECT=3 ;}}} Color w+/r+ "WARNING" Color w/n " This script will remove all published apps from this server"+@CRLF " Enter 'Y' to continue, or any other key to exit: " Get $ If $<>"Y" Exit 0 EndIf @CRLF ; Initialise FARM object {{{ $oFarm=CreateObject("MetaframeCOM.MetaframeFarm") If @ERROR Or VarType($oFarm)<>9 Abort("Cannot create FARM object",@ERROR,@SERROR) EndIf $oFarm.Initialize(1) If @ERROR Abort("Cannot create FARM object",@ERROR,@SERROR) EndIf ; }}} ; Backup all entries for this server to the config file. {{{ $sBackup=@WKSTA+" "+@DATE+" "+@TIME For Each $sApplication In Split(ReadProfileString($sIni,@WKSTA,""),Chr(10)) If $sApplication $sApplicationDN=ReadProfileString($sIni,@WKSTA,$sApplication) $=WriteProfileString($sBackupIni,$sBackup,$sApplication,$sApplicationDN) $=WriteProfileString($sIni,@WKSTA,$sApplication,"") EndIf Next ;}}} ; Remove applications {{{ For Each $oServer in $oFarm.servers If $oServer.serverName=@WKSTA Log("Match: "+$oServer.serverName) For Each $oApplication in $oServer.applications Log("App: "+$oApplication.appName+" ("+$oApplication.distinguishedName+")") $=WriteProfileString($sIni,@WKSTA,$oApplication.appName,$oApplication.distinguishedName) If @ERROR Abort("Cannot add application to backup file",@ERROR,@SERROR) EndIf $oApplication.LoadData(1) If @ERROR Abort("Cannot add load application state",@ERROR,@SERROR) EndIf $oApplication.RemoveServer(@WKSTA) If @ERROR Abort("Cannot add remove application from server",@ERROR,@SERROR) EndIf $oApplication.SaveData() If @ERROR Abort("Cannot save load application state",@ERROR,@SERROR) EndIf Next EndIf Next ; }}} Exit 0 Function Log($s) ; {{{ @DATE+" "+@TIME+" "+$s+@CRLF EndFunction ; }}} Function Abort($s,$iError,$sError) ; {{{ Log($s+IIF($iError="",""," ["+$iError+"]")+IIF($iError="",""," "+$sError)) Exit CInt($iError) EndFunction ; }}} ; vim600:ts=4 sw=4 ai fdc=4 fdm=marker
|
|
Top
|
|
|
|
#160714 - 2006-04-12 02:58 PM
Re: Get Published application
|
krex
Fresh Scripter
Registered: 2006-03-02
Posts: 39
|
Hi! This is almost working the only thing that i am missing is the commandline of the applications´. As i see it in MFCOM i need to get in contact with WinAppObject to get the Commandline. to fit in my script below it should be something like:
$ctxApp.WinAppObject ? "Workdir is - " +$ctxApp.DefaultInitProg
Now WinAppObject is a pointer how is pointer in kix.....? Is pointer not supportet or is there a work around...? Will pointer be supportet in kix in like.... Next week...?
$ctxfarm = CreateObject("MetaFrameCOM.MetaFrameFarm") $ctxfarm.Initialize(1) For Each $ctxApp In $ctxfarm.Applications ? "Published Application - " + $ctxApp.Appname For Each $AppGrp In $ctxApp.Groups ? "Groups - "+ $AppGrp.GroupName Next Next get $
|
|
Top
|
|
|
|
#160715 - 2006-04-12 04:06 PM
Re: Get Published application
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
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
|
|
Top
|
|
|
|
#160716 - 2006-04-18 08:49 AM
Re: Get Published application
|
krex
Fresh Scripter
Registered: 2006-03-02
Posts: 39
|
Thanks Richard!
Just one thing how do you know what numbers to initialize. Fx. $MetaFrameWinFarmObject=1 $MetaFrameWinAppObject=3
Is there a way to figurer this out cause then i would like know.
Thanks Again!
|
|
Top
|
|
|
|
#160718 - 2006-04-18 10:07 AM
Re: Get Published application
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
Here is a link to one from ASE at iTripoli
http://www.itripoli.com/itlv.asp
|
|
Top
|
|
|
|
#160719 - 2006-04-18 11:29 AM
Re: Get Published application
|
krex
Fresh Scripter
Registered: 2006-03-02
Posts: 39
|
Thanks! Richard and NTDOC
|
|
Top
|
|
|
|
#160720 - 2006-04-20 09:22 AM
Re: Get Published application
|
krex
Fresh Scripter
Registered: 2006-03-02
Posts: 39
|
Hi! I have to understand this and i cant seem to get it working. Now i want get the MFcom object: IMetaFrameContent Interface. I done the debug.print MetaFrameContent and i get nothing i been using the Object Browser that dident make any sense. but if i write debug.print metaframewinfarmobject i get 1.
The MetaFrameContent is an interface so.....?
I need to know how you get from one object to anothere and the to an interface. I been reading Citrix SDK MFCOM and theres no help to beginners and i tryede reading othere things on the net.
Basic is i know how i se the properties/methodes of an object but i dont know how to get from object to object or interface. how do i get from classes to classes thats the ?
Hope this make sense
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 764 anonymous users online.
|
|
|