• View Communities
    • Citrix Developer Network
      The place for unfiltered straight talk on Citrix products. Blogs, code downloads, best practices, APIs, and more can all be found here.
    • Citrix Ready Community Verified
      Does it work with Citrix? Application compatibility questions are a thing of the past with the new Citrix Community Verified site.
    • Blogs
      Learn the latest from the Citrix employees who are building application delivery infrastructure technologies.
    • Blogosphere
      The Citrix Blogosphere is a window into the thousands of conversations taking place about Citrix and Application Delivery.
  •  Sign In
The Citrix Blog
Personal Blog
Christian Gehring
Version 1 by Christian Gehring
on Jul 25, 2008 04:13.


 
compared with
Current by Vishal Ganeriwala
on Aug 07, 2008 15:48.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 0 changes. View first change.

 Microsoft Windows PowerShell command line shell and scripting language helps IT professionals achieve greater control and productivity. Using a new admin-focused scripting language, more than 130 standard command line tools, and consistent syntax and utilities, Windows PowerShell allows IT professionals to control system administration and accelerate automation more easily
  
 With PowerShell, Citrix Administrators can script MFCom Objects to manage and administer  the XenApp Farm. The secret of using COM objects starts with the command: New-Object \-COM.
  
 The following PowerShell example creates a new MetaFrame object (do not get confused with the COM Object naming), initializes the Farm and prints out the farmname:
  
 {color:purple}$farm{color} {color:red}={color} {color:cadetblue}{*}new-Object{*}{color} {color:black}\-com{color} {color:maroon}"MetaframeCOM.MetaframeFarm"{color}
 {color:purple}$farm{color}{color:black}.Initialize(1){color}
 {color:purple}$farm{color}.FarmName
  
 It's not going to be a spectacular script. But look at the following little code enhancement:\\
  
 {color:purple}$farm{color} {color:red}={color} {color:cadetblue}{*}new-Object{*}{color} {color:black}\-com{color} {color:maroon}"MetaframeCOM.MetaframeFarm"{color}
 {color:purple}$farm{color}{color:black}.Initialize(1){color}
 {color:purple}$farm{color}{color:black}.FarmName{color}
 {color:purple}$farm{color}{color:black}.sessions \|{color} {color:cadetblue}{*}Format-Table{*}{color} {color:maroon}UserName{color}{color:black},{color}{color:maroon}ClientAddress{color}
  
 Just adding one more lines of code and you will get all sessions within the farm displaying the Username and IP Address.\\
  
 h2. {color:#00549f}Setting up your PowerShell / MFCom environment{color}
  
 Beginning  with PowerShell / MFCom Scripting you should install Microsoft Powershell on a Citrix Presentation / XenApp Server in your lab. I recommend downloading the PowerShell Graphical Helpfile which also provides great information's about VBScript to PowerShell conversion.
  
 For creating and editing your PowerShell scripts I suggest downloading the free PowerGui graphical user interface and script editor. Its easy to use and works well with COM Objects.
  
 *PowerShell*
 [http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx]
  
 *PowerShell Graphical Help File*
 [http://www.microsoft.com/downloads/details.aspx?FamilyId=3B3F7CE4-43EA-4A21-90CC-966A7FC6C6E8&displaylang=en]
  
 *PowerGui - Graphical user interface and script editor*
 http://www.powergui.org
 \\ !powergui.jpg!
  
 h2. {color:#00549f}Displaying apps in your farm{color}
  
 To give you some basic ideas where PowerShell leverages your daily administrative tasks, I've created the following script:
 {color:purple}$farm{color} {color:red}={color} {color:cadetblue}{*}new-Object{*}{color} {color:black}\-com{color} {color:maroon}"MetaframeCOM.MetaframeFarm"{color}
 {color:purple}$farm{color}{color:black}.Initialize(1){color}
 {color:purple}$farm{color}{color:black}.FarmName{color}
 {color:purple}$farm{color}{color:black}.applications\|{color} {color:blue}where{color} {color:black}{{color}{color:navy}$\_{color}{color:black}.BrowserName{color} {color:red}\-like{color} {color:maroon}"Winword*"{color} {color:black}} \| *select* {color:maroon}DistinguishedName{color}
 \\
  
 The script above enumerates each application published in the farm and selects all applications where Winword\* is contained in the BrowserName.
  
 h2. {color:#00549f}PowerShell Examples provided by CDN{color}
  
 PowerShell and other scripting examples can be found on the Citrix Developer Network:
  
 [http://community.citrix.com/label/cdn/powershell]\\