Brian Madden Logo
Your independent source for application and desktop virtualization.
Marketplace

advertisement

Scripting Load Evaluators, in the Scripting / Automation forum on BrianMadden.com

rated by 0 users
This post has 16 Replies | 0 Followers

Top 200 Contributor
Points 769
Brian Cahill Posted: 04-14-2005 4:34 PM
Is there anyway to script Load Evaluators?

I found a script to remove all published apps and add back all published apps but this process removes all Load Evaluators. Does anyone have an idea on where those values are stored on a server or if there is a MFCOM method to this?
  • | Post Points: 35
Top 200 Contributor
Points 769
I found the IMetaFrameLoadevaluator object...currently developing a GUI front end in VB.NET
  • | Post Points: 5
If anyone is interested in a VB.NET application that allows you to add/remove servers and load evaluators to published apps with a click of a button, please email me at brian.cahill@qg.com. I will have to tailor it to your environment but it works pretty well. It is much better than clicking through the CMC...tested on Presentation Server 3.0 running on Windows 2003
  • | Post Points: 5
[&o]
Good Morning,

I'm french, so please escuse me for my English....
Where can I found information on IMetaFrameLoadEvaluator object.
I want to programm an automate which list me the Load Manager "Calculator" and their properties.

Thanks.
  • | Post Points: 20
Top 200 Contributor
Points 769
this will list out all Load Evaluators in the farm:


Dim mfFarm

Dim mfLE

Set mfFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
mfFarm.Initialize 1

For Each mfLE In mfFarm.LoadEvaluators
mfLE.LoadData 1

WScript.Echo "Load Evaluator Name - " & mfLE.LEName

Next
  • | Post Points: 35
Top 500 Contributor
Points 505
Is there a way to apply a load evaluator to a server from a command line?
I have a load evaluator that puts a server in "maintenance mode" (reports full loaded) so no-one cant connect, and would like to be able to apply it from a script, if e.g. IMA stops responding.

regards/
  • | Post Points: 35
I have been trying to grab load evaluators applied to servers.
e.g. when querying each server in the farm, return the applied load evaluator for that server. We use the scheduling to offline servers. I would like to run a report each morning to ensure we know exactly which servers we offlined by checking the applied LE on each one.
Here is the piece i am trying to make work. Returning the LEName is the tricky one...

For Each aZone In theFarm.Zones
WScript.Echo "ZoneName : " & aZone.ZoneName
WScript.Echo "DataCollector : " & aZone.DataCollector
WScript.Echo "All Servers in the zone: "
For Each aServer In aZone.Servers
Set theFarmLE = CreateObject("MetaFrameCOM.MetaFrameLoadEvaluator")
theFarmLE.AttachToServerByName True,aServer.ServerName
wscript.Echo theFarmLE.LEName
Next
Next
Does anyone have any suggestions?

Thanks,
Chris
  • | Post Points: 5
Not Ranked
Points 174
[quote=Rene Kierstein] Is there a way to apply a load evaluator to a server from a command line?
I have a load evaluator that puts a server in "maintenance mode" (reports full loaded) so no-one cant connect, and would like to be able to apply it from a script, if e.g. IMA stops responding.

regards/

[/quote]

I am looking to perform the same type of task. Has anyone found a command line to apply load evaluators?

Thanks
  • | Post Points: 20
Not Ranked
Points 20
use server object to do this. make sure you give Load Evaluator exactly as it is in CMC.
  • | Post Points: 20
Top 500 Contributor
Points 385
So I am clear.. you have a load evaluator.. you just want to assign a machine to it at the cmdline.. is that correct?
Brandon Shell [MVP]
a.k.a BSonPosh

Note: If you want help learning Powershell or your struggling with some concepts... feel free to contact me through a post or my blog. I spend what time I have helping you learn. I do think I should be clear... I want to help you LEARN... not do your job for you. I will NOT simply write scripts for you if I do not think you wish to learn. I will spend hours if I think I can help you learn... I will not waste 5mins if I think your just want an easy way out.
  • | Post Points: 5
Top 500 Contributor
Points 385
Brandon Shell replied on 10-03-2007 8:49 AM
If you dont mind using powershell... this work exactly how I understand you want

Add this to your profile.
function Get-CitrixServer{
Param($Server)
$type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Server)
$mfServer = [system.Activator]::CreateInstance($type)
$mfServer.Initialize(6,$Server)
$mfServer
}

Anytime you want to add the load Evaluator just type
PS> (get-citrixserver Server1).AttachLEByName('LEName')

If you like this and want more info... just let me know.
Brandon Shell [MVP]
a.k.a BSonPosh

Note: If you want help learning Powershell or your struggling with some concepts... feel free to contact me through a post or my blog. I spend what time I have helping you learn. I do think I should be clear... I want to help you LEARN... not do your job for you. I will NOT simply write scripts for you if I do not think you wish to learn. I will spend hours if I think I can help you learn... I will not waste 5mins if I think your just want an easy way out.
  • | Post Points: 20
Not Ranked
Points 174
I will have to look into PowerShell. I don't believe we currently have it in our infrastructure. With this, would I be able to apply the load evaluator via a script?
  • | Post Points: 20
Top 500 Contributor
Points 385
Brandon Shell replied on 10-03-2007 5:55 PM
Yes! Not only will you be able to run a script, if you wish, you can even do it interactively.

Here is example
---------------
PS> $myserver = Get-CitrixServer ServerName
PS> $myserver.AttachLEByName('LEName')
do your testing
PS> $myserver.AttachLEByName('OrginalName')

You may also be shocked at what you can get to on $myserver. Do the following to look at the object properties you see.
PS> $myserver | get-member

The great benefit from Powershell over other scripting langauges is that its interative and you get access to objects at the command shell layer.
Brandon Shell [MVP]
a.k.a BSonPosh

Note: If you want help learning Powershell or your struggling with some concepts... feel free to contact me through a post or my blog. I spend what time I have helping you learn. I do think I should be clear... I want to help you LEARN... not do your job for you. I will NOT simply write scripts for you if I do not think you wish to learn. I will spend hours if I think I can help you learn... I will not waste 5mins if I think your just want an easy way out.
  • | Post Points: 5
Not Ranked
Points 25
Check out the script below. Hope this helps.

' __________________________________________________________________

'
' Script Name: AttachLE.vbs
'
' Purpose: Attaches a load evaluator to a Citrix farm server.
'
' Syntax: attachle servername lename
'
' servername The farm server's computer name.
' lename The load evaluator's name.
'
' Author/Email : Frank-Peter Schultze
' Last Update : 05-Mar-2007
' __________________________________________________________________
'
If (WScript.Arguments.Count <> 2) Then
WScript.Echo "Attaches a load evaluator to a Citrix farm server."
WScript.Echo ""
WScript.Echo WScript.ScriptName & " servername lename"
WScript.Echo ""
WScript.Echo " servername The farm server's computer name."
WScript.Echo " lename The load evaluator's name."
WScript.Quit
End If
strFarmServer = WScript.Arguments(0)
strLEName = WScript.Arguments(1)
Set objFarm = CreateObject("MetaFrameCOM.MetaFrameLoadEvaluator")
objFarm.LEName = strLEName
objFarm.LoadData(True)
objFarm.AttachToServerByName False, strFarmServer
objFarm.SaveData()
Set objFarm = Nothing
Frank-Peter Schultze
Consultant

Log·in Consultants Germany GmbH
www.loginconsultants.com
  • | Post Points: 20
Top 500 Contributor
Points 456