Codelinguist's Blog

Archive for the ‘Centralized Computing’ Category

Citrix MFCOM script to get list of servers and their IP addresses on a farm

Posted by c0del1ngu1st on September 20, 2011

By using the following script you can get the list of servers along with their IP addresses published on a farm. The result would be generated in MS Excel. So you must have MS Excel installed on your system in order to execute it.

Code:

<package>

<job id=” FarmApplications”>

<runtime>

<description>

List Servers and their IP address for all apps in the farm.

</description>

</runtime>

<reference object=”MetaFrameCOM.MetaFrameFarm”/>

<script language=”VBScript”>

Dim wkbNew

Set objExcel = CreateObject(“Excel.Application”)

Set wkbNew = objExcel.Workbooks.Add

set wksNew = wkbNew.Worksheets(1)

wksNew.Activate

wksNew.Application.Visible = True

Dim theFarm,AppName ,anApp,aServer, Array()

Set oShell = WScript.CreateObject(“WScript.Shell”)

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

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

‘WScript.Echo “MetaFrame Farm Name: ” & theFarm.FarmName

‘WScript.Echo “”

Row = 1

Col = 1

maxServer = 0

wksNew.Cells(Row, Col).Value = “Server”

wksNew.Cells(Row, Col + 1).Value = “IP address”

For Each anApp In theFarm.Servers

Row = Row + 1

Col = 1

if Err.Number <> 0 Then

WScript.Echo “Can’t enumerate applications”

WScript.Echo “(” & Err.Number & “) ” & Err.Description

WScript.Echo “”

WScript.Quit Err.Number

End if

wksNew.Cells(Row, Col).Value = aServer.ServerName

wksNew.Cells(Row, Col + 1).Value = aServer.IPAddress

numServers = anApp.Servers.Count

If numServers > maxServers Then

maxServers = numServers

End If

Next

For sCount = 1 To maxServers

wksNew.Cells(1, scount + 5).Value = “Server” & scount

Next

wksNew.Range(wksNew.Cells(2, 1), wksNew.Cells(Row, maxServers + 5)).Sort wksNew.Range(“A2”),,,,,,,xlNo

wksNew.Range(“B2”).Select

objExcel.ActiveWindow.FreezePanes = True

wksNew.Range(wksNew.Cells(1, 1), wksNew.Cells(1, maxServers + 5)).Select

wksNew.Range(wksNew.Cells(1, 1), wksNew.Cells(1, maxServers + 5)).Interior.ColorIndex = 16

wksNew.Range(wksNew.Cells(1, 1), wksNew.Cells(1, maxServers + 5)).Font.ColorIndex = 2

wksNew.Range(wksNew.Cells(1, 1), wksNew.Cells(1, maxServers + 5)).Font.Bold = True

wksNew.Range(wksNew.Cells(1, 1), wksNew.Cells(1, maxServers + 5)).HorizontalAlignment = 7

wksNew.Range(wksNew.Cells(1, 1), wksNew.Cells(1, maxServers + 5)).AutoFilter

wksNew.Range(wksNew.Cells(2, 1), wksNew.Cells(Row, maxServers + 5)).Columns.AutoFit

</script>

</job>

</package>

Execute on the any server of farm, whose information you want. Hope you enjoy executing this script.

Advertisements

Posted in Application Virtualization, Centralized Computing, Citrix, MFCOM, Script, Server | Leave a Comment »

My first Citrix MFCOM script

Posted by c0del1ngu1st on September 20, 2011

This is my first MFCOM script. MFCOM scripts are scripts for Citrix servers. MFCOM first appeared in 2001 as a hotfix for MetaFrame XP 1.0, which was released about 6 months prior to the hotfix release. This is my first MFCOM scripts.
The following is a simple Windows Scripting Host script. It prints out the name of the farm and some properties. To make reading the script easier, comments and explanations are inserted in between the code.

<package>

<job id=”Farm”>

<comment>

File: Farm.wsf

Description: A simple script displaying farm properties.

</comment>

<runtime>

<description>

A simple script displaying farm properties.

</description>

</runtime>

<reference object=”MetaFrameCOM.MetaFrameFarm”/>

<script language=”VBScript”>

Dim theFarm, theWinFarm

‘ 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

‘ Get MetaFrameWinFarm2 object

Set theWinFarm = theFarm.WinFarmObject2

if Err.Number <> 0 Then

WScript.Echo “Can’t receive MetaFrameWinFarm2 object”

WScript.Echo “(” & Err.Number & “) ” & Err.Description

WScript.Echo “”

WScript.Quit Err.Number

End if

‘ Are you a Citrix Administrator?

if theWinFarm.IsCitrixAdministrator = 0 then

WScript.Echo “You must be a Citrix admin to run this script”

WScript.Echo “”

WScript.Quit 0

End If

‘ Print out the farm name.

WScript.Echo “MetaFrame Farm Name: ” & theFarm.FarmName

‘ Print out some of the MetaFrameWinFarm2 object properties.

WScript.Echo “MetaFrame WinFarm object properties”

WScript.Echo “DegradationBias : ” & theWinFarm.DegradationBias

WScript.Echo “UseClientLocalTime: ” &                                                                                                  theWinFarm.UseClientLocalTime

WScript.Echo “Press ENTER to exit…”

WScript.StdIn.Read(1)

</script>

</job>

</package>

Save it as farm .wsf on your server. Script will tell you the name of the server.
Hope you would enjoy running it.

Posted in Application Virtualization, Centralized Computing, Citrix, MFCOM, Script | Tagged: , | Leave a Comment »

Birth of Citrix servers

Posted by c0del1ngu1st on September 15, 2011

Concept of resource sharing has been there from long time. The practice of this computing model dates back to mainframes with green-screen terminals. Computing has changed dramatically since those days but the basic premise of “centralized” computing hasn’t changed a great deal.

The system used was centralized or server-based computing in which many users were able to share same computer resources. The approach was used because computers then cost hundreds of thousands, if not millions, of dollars to acquire and typically cost even more to maintain and operate and computers were at best the size of large cars, so distributing one to each user’s desk would be impossible for any corporation. The time has changed since then. At that time centrally managed end-user devices were the only option because of the reasons mentioned above but today they are optional.

The popularity of centralized computing waned for several years as the advent of the personal computer (PC) allowed end users to have the power of the mainframe on the desktop without the expense of the mainframe. Individual PCs gave rise to the need for networking, so we began to tie PCs together to allow the sharing of files and printers. Over time, our use of computers went from a centralized to a decentralized model as PCs were cheaper to maintain and purchase than mainframes and minicomputers. A host of new applications allowed for a much greater range of computing uses, such as word processing, spreadsheets, and e-mail.

We slowly moved from the point of placing computers on engineers’ desktops to placing computers on everyone’s desktop. We moved the majority of our computing power to the edge of the network, along with the majority of support issues. Anyone who has ever managed a network knows that purchasing the computer is the least expensive part of owning a computer. Maintenance, training, upgrades, viruses, and spyware all add up to the bulk of the cost over time for PC ownership. Several studies indicate that the initial capital outlay for the purchase of new computing hardware and software only accounts for about 10 percent of the actual cost over a three-year period (then you get to start all over!).

This process of suburban sprawl inside our networks continued unchecked for several years. With the passage of time, IT professionals started moving toward putting all those applications and tools that users run on their desktops to the central computers to manage the applications centrally on controlled, reliable, enterprise-grade hardware to increase uptime. We started creating highly available server “farms” to allow for reliable user connections instead of single points of failure. Thus the need of Terminal Services and Citrix servers was born.

Posted in Application Virtualization, Centralized Computing, Citrix, PC, Server | Leave a Comment »

 
%d bloggers like this: