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 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.
Comments (3)
Jul 03, 2008
Vishal Ganeriwala says:
great script thanksgreat script thanks
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.
Jul 16
Arunkumar Ramasamy says:
anyone help me how to modify this script to group of citrix servers in a Farmanyone help me how to modify this script to group of citrix servers in a Farm
Add Comment