Posts RSS Comments RSS 253 Posts and 411 Comments till now

Blog Archives

blog: Happy 20th Citrix!

Hard to believe, but Citrix is 20years old today.

They have come a long way and seem to have bright future.

Happy 20th Citrix!

Hard to believe, but Citrix is 20years old today.

They have come a long way and seem to have bright future.

Citrix News! I have join the Citrix Technology Professional ranks!

I was notified last week, but I wanted to wait till my profile was up on the site. For those of you wondering what in the heck that is… it is basically Citrix version of the MVP program. It will allow me to interact more directly with Citrix. I am sure this will be a mutually beneficial relationship. They have made a huge stake in Powershell and I want to do my best to help direct or guide their adoption.

You can read more about the program Here.

In other news and more important to you as a reader :)

Citrix is working on a set of Powershell cmdlets for XenApp 5 (most of them should work in XenApp 4.5 if you have HR3 installed.) We have been in closed beta, but I have got to tell you… this is good stuff. They did a stellar job and have been very open to feedback. These cmdlets should make my scripts obsolete and I am very much looking forward to it. I will be releasing details and demo's as soon as I am allowed.

OH! Did I mention I am doing a Geek Speak Session at Synergy? Well I am!

At this point I just know I am on Wednesday at some time, but I will be there all week if you around. Just email!

Lets show them we Powershell people are serious! Vote for my session here: VOTE!

Citrix News! I have join the Citrix Technology Professional ranks!

I was notified last week, but I wanted to wait till my profile was up on the site. For those of you wondering what in the heck that is… it is basically Citrix version of the MVP program. It will allow me to interact more directly with Citrix. I am sure this will be a mutually beneficial relationship. They have made a huge stake in Powershell and I want to do my best to help direct or guide their adoption.

You can read more about the program Here.

In other news and more important to you as a reader 🙂

Citrix is working on a set of Powershell cmdlets for XenApp 5 (most of them should work in XenApp 4.5 if you have HR3 installed.) We have been in closed beta, but I have got to tell you… this is good stuff. They did a stellar job and have been very open to feedback. These cmdlets should make my scripts obsolete and I am very much looking forward to it. I will be releasing details and demo’s as soon as I am allowed.

OH! Did I mention I am doing a Geek Speak Session at Synergy? Well I am!

At this point I just know I am on Wednesday at some time, but I will be there all week if you around. Just email!

Lets show them we Powershell people are serious! Vote for my session here: VOTE!

How to get the elusive developer license for XenApp

Have you heard stories of the mystical developer license for XenApp, but couldn’t find it?
Have you ever wanted to install XenApp just to test or play with?

These question often plague my readers, but below… below you will find “The Link.” Beware! This is no ordinary link. This is a magical link that will take you on a journey. A journey in which you will find the treasure. The treasure that will finally let you take a hold of this mystical license.

Let the Quest be fulfilled! How to get an eval or a developer license for Citrix XenApp

Test-CitrixHotfix

I often find the need to compare the state of my PS servers. This little script allows me to find all the Citrix hotfixes for a group of server(s), or list of server(s) that have a specific hotfix.

Parameters:
$File: The name of the file which contains a list of servers
$Filter: Name or Regex of the Hotfix(es) to return
$Server: Name of the server to check

What it returns (a custom object):
ServerName: Name of the Server with the Hotfix(es)
Hotfixes: List of hotfix names [String[]]
RawObjects: Array of MFCOM MetaFrameHotfix objects

Examples
To List all the Hotfixes on a list of servers
.\Test-CitrixHotfix.ps1 ServerList.txt

To List a Specific hotfix on a list of servers
.\Test-CitrixHotfix.ps1 ServerList.txt -filter PSE450W2K3021

To List all the hotfixes on a specific Server
.\Test-CitrixHotfix.ps1 -s Server1

To List a specific hotfix for a specific server
.\Test-CitrixHotfix.ps1 -s Server1 -filter PSE450W2K3021

The Code:

Param($file,$filter=".*",$server)

Function Ping-Server {
   Param([string]$server)
   $pingresult = Get-WmiObject win32_pingstatus -f "address=’$Server’"
   if($pingresult.statuscode -eq 0) {$true} else {$false}
}
Function Check-CitrixHotfix{
    Param([string]$server)
    $mf = New-Object -ComObject MetaframeCOM.MetaframeFarm
    $mf.Initialize(1)
    $srv = $mf.GetServer2(6,$server)
    $list = $srv.winServerObject2.hotfixes | ?{$_.Name -match $filter}
    $list
}

if($file -and (Test-Path $file))
{
    $servers = cat $file
}
if($input)
{
    $servers = $input
}

if($server){$servers += $server}

foreach($srv in $servers)
{
    if(Ping-Server $srv)
    {
        $hotfixes = Check-CitrixHotfix $srv
        $myobj = "" | Select-Object ServerName,Hotfixes,RawObjects
        $myobj.ServerName = $srv
        $myobj.Hotfixes   =  $hotfixes | %{$_.Name}
        $myobj.RawObjects = $hotfixes
        $myobj
    }
    else
    {
        write-host $srv
        write-host "————"
        write-host "Server not pingable"
    }
}

It is a Poll day for me (This one is from Citrix)

VOTE!!!
http://community.citrix.com/blogs/citrite/vishalg/2008/09/25/Create+a+XenServer+virtual+machine+from+a++template+using+XAPI

Multiple Paths to the same End (Citrix)

Today I was asked this question

“Is there a more efficient way to list each published app and list out servers that are associated with it? In hope to give me an output that will display the ‘AppName’ objects once and display all the servers.”

He was referring to script I have posted somewhere (/shrug.)

I knew exactly what he wanted and thought “HEY! This would be a good time to blog about MFCom object Nesting.”

What do I mean by “MFCom object Nesting?” I simply mean that MFCom object model is nested in such a way that you can attain the same information from various code paths. For example, Farm objects contain Application objects which contain Server objects, but Farm objects also have Server objects which contain Application objects.

Farm -> Applications -> Servers
Or
Farm -> Servers -> Applications

Why is this important or why would Citrix do this? IMO, it is to provide a shorter code path for the information you want.

Here are some examples

In the case of the question I received, what he had required getting all the applications from each server and returning the information like this:

$mfarm.Servers | Select ServerName -expandproperty Applications | Select ServerName,
                                                                          AppName,
                                                                          DistinguishedName,
                                                                          @{n="Groups";e={$_.Groups | %{$_.GroupName}}}

What he wanted to get was all the applications and output the information directly like:

$mfarm.Applications | %{$_.LoadData(1);$_} | Select-Object AppName,
                                                           DistinguishedName,
                                                           @{n=‘Groups’;e={$_.Groups | %{$_.GroupName}}},
                                                           @{n=‘Servers’;e={$_.Servers | %{$_.ServerName}}}

 
Perhaps a more direct example would be collecting Sessions. If I want all the Sessions for a Server I could do one of the following:

$farm.Sessions | ?{$_.ServerName –match "Server1"}

this works, but has to touch all my sessions… a better way would be like:

Get-CitrixServer  "Server1" | %{$_.Sessions}

 
More Info on LoadData()
If you are not familiar with the LoadData() method on the Application object it is critical that you get familiar, and get familiar quick.

LoadData() was introduced in MPS 4.0 (I believe) to allow the farm (or directly instantiated Application objects) to be returned with just a small bit of information. This allows you to quickly get basic application information without having to collect the entire data set, saving both time and network traffic. The problem is that most people do not know this and it can get quiet messy.

Why is it messy? If you get an application and set a property (like adding a user) and then commit the data back to the server using the SaveData() method, what do you think will happen? One could expect it would only update that which has change, but one would be wrong. When you call SaveData() it actually commits whatever is in local memory to the farm (yup, you got it… HOSED!) You just committed an effectively empty application and set it back to the Farm wiping out any existing information.

Moral of the story? USE LoadData().

Using Citrix MFCOM Inpersonation Remotely

I often get questions about scripts running with no errors, but not returning any valid information.

For example

$mfFarm = New-object -com "MetaframeCOM.MetaFrameFarm"
$mfFarm.Initialize(1)
$mfFarm.FarmName # will return the Farm Name, but that is it.
$mfFarm | gm # all the properties are there, but blank
# But none of the properties provide any info
$mfFarm.Admins # returns nothing



I ran into this a while back and meant to blog it but forgot. I was asked this question again today and decided to finally get to blogging it.

Reason:
Generally the cause is that MFCOM is not configure for impersonation. MFCom needs to be able to act as if it is the user using the script. This is called impersonation. To make this work, you must configure DCOM to use impersonation using the article below.

Solution:
See here for more info and how to change it.
Configuring MFCOM Access Security

Looking for interesting Citrix Problems

I am working on some blog entries and content for Citrix CDN and was curious what you guys thought.

If you have time, please leave some comments on problems or suggestions of things you would like to see. Specifically I am looking for some “real” world scenarios that I can present and provide solutions for.

« Prev - Next »