• 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
XenApp Developer Network

Add All Servers in Farm to Load Evaluator

Add All Servers in Farm to Load Evaluator

Description

Allows you to quickly assign the Default, Advanced, or a custom load evaluator to all servers in the farm.  The line objFarm.LEName = "LMSDefaultLE" species the Advanced Load Evaluator.  "LMSDefaultLE" may be replaced with "MFDefaultLE" to assign the Default Load Evaluator or the name of a custom created one.

Download

Click here to download the script file

Code Snippet

' Date: 7-3-08
' Author: Allen Furmanski
' Purpose: Assign Advanced Load evaluator to all servers in farm
<package>
 <job id="Servers">
<runtime>
 <description>
Assign advanced load evaluator to all servers in farm
</description>
 </runtime>
<reference object="MetaFrameCOM.MetaFrameFarm"/>
 <script language="VBScript">

Dim theFarm, aServer, aWinServer

' Create MetaFrameFarm object
Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
if Err.Number <> 0 Then
 WScript.Echo "Can't create MetaFrameFarm object"
 WScript.Echo "(" & Err.Number & ") " & Err.Description
 WScript.Echo ""
 WScript.Quit Err.Number
End if


' Initialize the farm object
 theFarm.Initialize(MetaFrameWinFarmObject)
 if Err.Number <> 0 Then
 WScript.Echo "Can't&nbsp; Initialize MetaFrameFarm object"
 WScript.Echo "(" & Err.Number & ") " & Err.Description
 WScript.Echo ""
 WScript.Quit Err.Number
End if

' Check to make sure user is farm admin
if theFarm.WinFarmObject.IsCitrixAdministrator = 0 then
 WScript.Echo "You must be a Citrix admin to run this script"
 WScript.Echo ""
 WScript.Quit 0
 End If


' Create object for load evaluator
Set objFarm = CreateObject("MetaFrameCOM.MetaFrameLoadEvaluator")
objFarm.LEName = "LMSDefaultLE" ' Set name to name of Advanced LE in Data Store
 For Each aServer In theFarm.Servers
 if Err.Number <> 0 Then
 WScript.Echo "Can't enumerate servers"
 WScript.Echo "(" & Err.Number & ") " & Err.Description
 WScript.Echo ""
WScript.Quit Err.Number
End if

objFarm.LoadData(True)
objFarm.AttachToServerByName False, aServer.ServerName
objFarm.SaveData()
Next

Set objFarm = Nothing

 WScript.Echo "Advanced Load Evaluator has been applied to all servers."
 </script>
 </job>
</package>

Disclaimer

These software applications are provided to you as is with no representations, warranties or conditions of any kind. You may use and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software application may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the software application fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software application. In no event should the code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SOFTWARE APPLICATION, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code.

Tags

mfcom mfcom Delete
code share code share Delete
add all servers add all servers Delete
Enter tags to add to this page:
Please wait 
Looking for a tag? Just start typing.
  1. Jul 03, 2008

    Vishal Ganeriwala says:

    great script thanks

    great script thanks

  2. Jul 09, 2008

    Josef Malmborg says:

    Yeah. I looked for a long time after some way to disable server but not disable...

    Yeah.

    I looked for a long time after some way to disable server but not disable it for logged in users. I came with the solution that I create a load evaluator called "disablelogons". In that I set report full load when users exceeds = 1 and content switches are higher than = 10.

    So, then the server report fully load for new users but disconnected users can still reconnect.

    But now I want a script for setting the server to this load evaluator like during the night so when I´m back at office there should be no users on those servers.

  3. Jul 16

    Arunkumar Ramasamy says:

    anyone help me how to modify this script to group of citrix servers in a Farm

    anyone help me how to modify this script to group of citrix servers in a Farm

Add Comment

Related Links