String Theory

Mastering the laws of physics with Windows PowerShell

Browsing Posts in Atlanta Citrix User Group

Date:

09/01/2010 (Wednesday)
Time: 11:00AM – 1:30PM EDT

Description:
The User Group
meetings provide members with an opportunity to share and learn about
common issues and utilization of Server Based Computing technology.
Additional segments include troubleshooting tips, best practices,
enterprise solutions, technology trends, vendor presentations and
upcoming activities of interest.

Agenda:
11:00am: Registration
11:15am: Opening Remarks and Organization News
11:30am: Citrix Announcements – Product Updates, Beta Announcements & Tech Releases
11:45am: Lunch
12:00pm: Citrix XenDesktop – Jonathan O’Brien, Citrix Systems
1:00pm: Open Discussion

Location:
Microsoft Southeast Regional Office – Alpharetta
1125 Sanctuary Pkwy., Suite 300
Alpharetta, GA 30009
Phone: (678) 629-5700

Registration: http://www.acug.org/index.php?view=details&id=2%3Aseptember-atlanta-citrix-user-group-meeting&option=com_eventlist&Itemid=53

I recently gave a presentation on the Citrix XenApp cmdlets for the Atlanta Citrix User Group.  For the presentation I wanted to show a real world example of the cmdlets in use. I decided to take a script that I wrote in July of 2007 ,which is still in use today, and convert it to use the new XenApp PowerShell cmdlets.  Shown below is the original script.

The purpose of the script is to automatically create a published desktop for our XenApp servers as they are built.  It uses MFCOM to perform the work.  One of the pain points in this script is that I had to actually copy the icon from an existing published desktop. This is a problem that I don’t have with the cmdlets.

#=============================================================================
#= Script Name:      Citrix Admin Desktop Publishing Script
#= Created On:       07/11/2007
#= Author:           Mark E. Schill
#= File:             Publish-Desktop.ps1
#= Usage:
#= Version:          1.0
#= Purpose:          Publishes an Admin Desktop on the server it is run from.
#= Requirements:       Must be run on a Citrix server in the same farm
#= Last Updated:     07/11/2007
#= History:
#=                   07/11/2007 1.0 - Initial Revision
#=
#=                        Copyright (C) 2007 Mark E. Schill
#==============================================================================

function Publish-Desktop( [string]$ServerName)
{
    $CPSReferenceApp = New-Object -comOBject MetaFrameCOM.MetaFrameApplication
    $CPSReferenceApp.Initialize(3, "Applications/Admin/Desktops/WMT13-CTX-DC1 Desktop")
    $CPSReferenceApp.LoadData($true)
    $CPSReferenceIcon = $CPSReferenceApp.WinAppObject.IconObject

    $ServerName = $ServerName.ToUpper()
    $CPSFarm = New-Object -ComObject MetaFrameCOM.MetaFrameFarm
    $CPSFarm.Initialize(1)
    $CPSApp = $CPSFarm.AddApplication(3)
    $CPSApp.AppName = "$ServerName Desktop"
    $CPSApp.Description = "Admin Desktop for Remote Administration"
    $CPSApp.ParentFolderDN = "Applications/Admin/Desktops"
    $CPSApp.PNFolder = "Admin\Desktops"
    $CPSApp.WinAppObject.DefaultInitProg = ""
    $CPSApp.WinAppObject.DefaultWorkDir = ""
    $CPSApp.WinAppObject.DefaultWindowColor = 4 # 32 Bit
    $CPSApp.WinAppObject.DefaultWindowType = 6 # MFWINWindowPercent
    $CPSApp.WinAppObject.DefaultWindowScale = 95 # 95%

    $CPSApp.WinAppObject.PNAttributes = 8
    $CPSApp.WinAppObject.SetIconBitmaps( $CPSReferenceIcon.IconMaskSize, $CPSReferenceIcon.IconMaskBitmap, $CPSReferenceIcon.IconDataSize, $CPSReferenceIcon.IconDataBitmap)
    $CPSApp.AddUser( 1, "CDC", 4, "CTX-Admins")
    $CPSApp.AddUser( 1, "CDC", 4, "CTX-Support")
    $CPSApp.SaveData()
    $CPSAppBinding = New-Object -ComObject MetaFrameCOM.MetaFrameAppSrvBinding
    $CPSAppBinding.Initialize(6,$ServerName,$CPSApp.DistinguishedName)
    if ($CPSAppBinding)
    {
        Write-Host "Publishing"$CPSApp.BrowserName"on $ServerName" -foregroundcolor Green
        $CPSApp.AddServer($CPSAppBinding)
        $CPSApp.SaveData()

    }
    else
    {
        Write-Host "Unable to create App Binding" -foregroundcolor red
    }

}

Publish-Desktop("$env:COMPUTERNAME")

Shown below is the new “script”. As you can see it is actually a one-liner if you take out the function stuff. Also I don’t have the icon issue because it automatically creates the correct icon.

function Publish-Desktop( [string]$ServerName)
{
	New-XAApplication -ApplicationType ServerDesktop -DisplayName "$ServerName Desktop" -FolderPath "Applications/Admin/Desktops" -Description "Admin Desktop for Remote Administration" -ClientFolder "Admin\Desktops" -WindowType "95%" -ColorDepth TrueColor -Accounts "$ServerName\Administrators" -Servernames $Servername
}

As promised here is my PowerPoint presentation and demo code for the presentation I gave at the Atlanta Citrix User Group titled “Managing XenApp with Windows PowerShell”

Presentation: Managing XenApp with Windows PowerShell

Demo Code: Demo.ps1

 Atlanta Citrix User Group – www.acug.org
Tuesday, April 27th

Topics of Discussion

Mark Schill, User Group Member, - Powershell Scripting XenApp

Mark is the WebMaster for the ACUG.org website and Charter Member of the current rendition of the Atlanta Citrix User Group.  Mark has been implementing and supporting Citrix Products in the Atlanta area for years and is a prolific PowerShell scripter.  MFCOM is out and Powershell is in, so come listen to Mark give the User Group a foundation of PowerShell scripting on XenApp.

Marcia Orea, Citrix Systems Senior SE – Whats new with XenApp 6.0 – Overview, Demo, and Q&A

Marcia Orea is a Senior Southeast SE for Citrix Systems and this will be her first presentation at an ACUG meeting.  Come hear Marcia tell the User Group whats new in XenApp 6.0!

The User Group meetings provide members with an opportunity to share and learn about common issues and utilization of Server Based Computing  technology.  Additional segments include troubleshooting tips, best practices, enterprise solutions, technology trends, vendor presentations and upcoming activities of interest. 

When: Tuesday,  April 27, 2010
          11:00am – 1:30 pm
          Lunch will be provided (BBQ) and sponsored by Citrix Systems, inc

Where: Citrix Systems Support Office
           2001 Westside Pkwy
           Suite 260
           Alpharetta, GA 30004

Registration:  Our ACUG Website is down so to register for this event please send an e-mail to events@ACUG.org or simply reply to this message.  Registration enables us get a count of who will be attending so we can get an accurate food and drink order in.

A successful User Group is a partnership between all members

Powered by WordPress Web Design by SRS Solutions © 2010 String Theory Design by SRS Solutions