Posts RSS Comments RSS 253 Posts and 411 Comments till now

Get-CitrixAppServer.ps1 (Citrix Top 10)

This is pretty simple script. It is actually just an adaption from my Get-CitrixApplication.ps1 script posted at the bottom. There is a moment in time when you start thinking in terms of objects and stop thinking in terms of text output you are looking for.

This will make a huge difference in productivity and take you from constantly writing scripts to interactively getting the information you are after, but until you make the transition I will continue to provide scripts that do both 🙂

# Get-CitrixAppServer.ps1
# Brandon Shell [MVP]
# www.bsonposh.com
# Gets All the Servers for Specific App
Param($app)
$mfApp = New-Object -ComObject MetaFrameCOM.MetaFrameApplication
$mfApp.Initialize(3,$app)
$mfApp.LoadData(1)
$mfApp.Servers | %{$_.ServerName}

Here is the script that I use to return an Application object.

# Get-CitrixApplication.ps1
# Brandon Shell [MVP]
# www.bsonposh.com
# Gets a Citrix Application Object.
Param($app)
$mfApp = New-Object -ComObject MetaFrameCOM.MetaFrameApplication
$mfApp.Initialize(3,$app)
$mfApp.LoadData(1)
$mfApp

Then from the commandline I would just do this
PS> Get-CitrixApplication.ps1 “Applications\MyApp1” | %{$_.Servers} | %{$_.ServerName}

While this looks more complicated it is more versatile and easy to change. Lets say I want current User for this app instead.
PS> Get-CitrixApplication.ps1 “Applications\MyApp1” | %{$_.Sessions} | %{$_.UserName}

3 Responses to “Get-CitrixAppServer.ps1 (Citrix Top 10)”

  1. on 24 Jun 2009 at 6:33 amtheSane

    I have tried this, but as soon as I hit the line “$mfApp.LoadData(1)” the script hangs. I have left it for 30 minutes and it never progresses. Any suggestions?

  2. on 24 Jun 2009 at 8:33 amtshell

    What Citrix Version are you using?

  3. on 19 Nov 2009 at 3:51 pmShane

    Brandon, how can I backup published app data? I understand that published app backups are possible using PowerShell Citrix modules. thanks

Trackback this post | Feed on Comments to this post

Leave a Reply

You must be logged in to post a comment.