citrix mfcom programming for administrators

36
Citrix MFCOM Programming for Administrators October 2007

Upload: vishalganeriwala

Post on 27-Jun-2015

6.445 views

Category:

Technology


1 download

DESCRIPTION

This is a basic presentation done at Citrix IForum 2007 event. It is a good overview for anyone getting started with Citrix MFCOM

TRANSCRIPT

Page 1: Citrix Mfcom Programming For Administrators

Citrix MFCOM Programming for AdministratorsCitrix MFCOM Programming for Administrators

October 2007October 2007

Page 2: Citrix Mfcom Programming For Administrators

2© 2007 Citrix Systems, Inc. — All rights reserved

100 Applications 1000 Users

100,000 Clicks

Page 3: Citrix Mfcom Programming For Administrators

3© 2007 Citrix Systems, Inc. — All rights reserved

Introductions

Instructors

• Nitin Desai

• Vishal Ganeriwala

Facilitators

• Fred Liu

• Tom Kludy

• Jeff Reed

Page 4: Citrix Mfcom Programming For Administrators

4© 2007 Citrix Systems, Inc. — All rights reserved

Agenda

MFCOM Basics

Start Using MFCOM

Labs In Action

Future And Takeaways

Page 5: Citrix Mfcom Programming For Administrators

5© 2007 Citrix Systems, Inc. — All rights reserved

Agenda

Agenda item number 1

Start Using MFCOM

Labs In Action

Future And Takeaways

MFCOM Basics

Page 6: Citrix Mfcom Programming For Administrators

6© 2007 Citrix Systems, Inc. — All rights reserved

What is MFCOM?

• COM-based management interface

• Runs on every Citrix Presentation Server™ box

• Scriptable and COM programming language support

• Remote execution

Page 7: Citrix Mfcom Programming For Administrators

7© 2007 Citrix Systems, Inc. — All rights reserved

Work Smarter and Faster Using MFCOM

Integration with third-party software applications3

Information reporting2

Automate administration tasks1

Page 8: Citrix Mfcom Programming For Administrators

8© 2007 Citrix Systems, Inc. — All rights reserved

How Does MFCOM Work ?

MFCOM

IMA

LHC

DCOM

RPCSAL

SALSAL

Data Store

Data Collector

Citrix Presentation Server

Windows Machine

SAL : Subsystem Access Layer

Page 9: Citrix Mfcom Programming For Administrators

9© 2007 Citrix Systems, Inc. — All rights reserved

Common MFCOM Objects

Zones

Farm

Apps

Servers

Sessions

Policies

Servers

Users

Sessions

Apps

Processes

VCs

Page 10: Citrix Mfcom Programming For Administrators

10© 2007 Citrix Systems, Inc. — All rights reserved

Agenda

Agenda item number 1

MFCOM Basics

Labs In Action

Future and Takeaways

Start Using MFCOM

Page 11: Citrix Mfcom Programming For Administrators

11© 2007 Citrix Systems, Inc. — All rights reserved

DCOM

Port 2512

Today’s Setup For Class Demos

Client MachineMPS SDK

Lab1CPSCPS 4.5 VM

Lab2CPSCPS 4.5 VM

DCOM

IMAFarm Name: SDKDemo

Data Store: Lab1CPS

Zone Data Collector: Lab1CPS

Servers : Lab1CPS & Lab2CPS

Page 12: Citrix Mfcom Programming For Administrators

12© 2007 Citrix Systems, Inc. — All rights reserved

How Can I Get Started?

• Download SDK from: http://support.citrix.com/page.jspa?pageID=devCenter

• Browse Script Repository http://support.citrix.com/kb/category.jspa?categoryID=645&subCategoryID=645

Page 13: Citrix Mfcom Programming For Administrators

13© 2007 Citrix Systems, Inc. — All rights reserved

Setting Up Client and Server Machines

• Register the remote Citrix Presentation Server using: mfreg <servername>

• Use dcomcnfg to change the Impersonation level from identity to impersonate on Windows XP

• W2K3+SP1 CPS Server - Add remote MFCOM user to the DCOM Users Group

• Make sure you have administrative privileges for the Citrix Farm

Page 14: Citrix Mfcom Programming For Administrators

14© 2007 Citrix Systems, Inc. — All rights reserved

SampleExamples

Page 15: Citrix Mfcom Programming For Administrators

15© 2007 Citrix Systems, Inc. — All rights reserved

MPSSDK Documentation• MPSSDK Help System

• MFCOM browser • http://www.jasonconger.com/ShowPost.aspx?strID

=9686d808-19c0-4bad-a577-02d85f597a8d

Page 16: Citrix Mfcom Programming For Administrators

16© 2007 Citrix Systems, Inc. — All rights reserved

Displaying Farm Name

• Use of VBScriptTemplate.wsf to add code

• Use of MetaFrameFarm Object and its methods

Page 17: Citrix Mfcom Programming For Administrators

17© 2007 Citrix Systems, Inc. — All rights reserved

Navigating MFCOM …

• New version of interfaces with different releases• MetaFrameFarm object : IMetaFrameFarm6 (CPS4.0) inherits from

IMetaFrameFarm5 (CPS3.0)

• Scripts connect to the latest interfaces

• C++ - Use QueryInterface

• Drill down to appropriate level of object.• MetaFrameServer Object:

• IMetaFrameServer

• IMetaFrameWinServer

Finding the relevant interface

Page 18: Citrix Mfcom Programming For Administrators

18© 2007 Citrix Systems, Inc. — All rights reserved

Agenda

Agenda item number 1

MFCOM Basics

Start Using MFCOM

Future And Takeaways

Labs In Action

Page 19: Citrix Mfcom Programming For Administrators

19© 2007 Citrix Systems, Inc. — All rights reserved

What Will You Learn?

• When and how to use MFCOM

• Navigating the documentation

• Using major MFCOM objects

• Auditing the farm

• Automating Citrix Presentation Server™ management tasks

Page 20: Citrix Mfcom Programming For Administrators

20© 2007 Citrix Systems, Inc. — All rights reserved

Labs: Commonly Done Presentation Server Administration Tasks

• Lab 1: Servers and Applications

• Lab 2: Create a Load Evaluator

• Lab 3: Take the Server Offline

• Extra Credit:• Printing

Page 21: Citrix Mfcom Programming For Administrators

21© 2007 Citrix Systems, Inc. — All rights reserved

Auditing Using Enumerations

Zones

Farm

Apps

Servers

Sessions

Sessions

• Object associations as a powerful tool for auditing

Page 22: Citrix Mfcom Programming For Administrators

22© 2007 Citrix Systems, Inc. — All rights reserved

Lab 1 : Servers and Applications

• List servers and applications in the Farm.

• List Applications on each server.

• List Servers for each application

• Use of MetaFrameServer and MetaFrameApplication methods/properties.

Page 23: Citrix Mfcom Programming For Administrators

23© 2007 Citrix Systems, Inc. — All rights reserved

Simple Administration Tasks

• Creating new entities in the farm• Create an Object in MFCOM

• Initialize the necessary data

• SaveData – Saving data to IMA Datastore

• Changing the configuration settings for the existing entities• Create an Object (CreateObject method)

• Initialization – Initialize or set methods

• LoadData – Loading data from IMA Datastore

• Change the settings

• SaveData – Save data back to IMA Datastore

Page 24: Citrix Mfcom Programming For Administrators

24© 2007 Citrix Systems, Inc. — All rights reserved

Lab2 : Create a Load Evaluator

• Create a Load Evaluator

• Set the name and description

• Create a LMRule for CPU utilization

• Create a LMRules collection and add a rule

• Set Load Evaluator Rules and save the data

• Use of MetaFrameLoadEvaluator, MetaFrameLMRule and MetaFrameLMRules methods/properties.

Page 25: Citrix Mfcom Programming For Administrators

25© 2007 Citrix Systems, Inc. — All rights reserved

Inside MFCOM

• COM Free threading model

• Error reporting• Limited error codes as HRESULT

• Exceptions in. NET

• MFCOM user• Current user vs. other user (runas)

• MFCOM impersonates before calling IMA

Page 26: Citrix Mfcom Programming For Administrators

26© 2007 Citrix Systems, Inc. — All rights reserved

Complex Management Tasks

• Connecting more than one entity in the farm

• Series of tasks with proper ordering

• Repetitive pattern

• Examples• Take the server offline

• Migrate applications from one farm to another

• Remove the server from N applications

Page 27: Citrix Mfcom Programming For Administrators

27© 2007 Citrix Systems, Inc. — All rights reserved

Lab3 : Taking The Server Offline

• How to take the server offline for maintenance purpose gracefully?

• Steps - 1. Prevent the new connections

2. Communicate to the users

3. Let the connections drain

4. Logoff the sessions after timeout period

• Use of MetaFrameLoadEvaluator, MetaFrameSession and MetaFrameServer methods/properties.

Page 28: Citrix Mfcom Programming For Administrators

28© 2007 Citrix Systems, Inc. — All rights reserved

Advanced MFCOM Usage

• Multi farm management• Create objects on the multiple remote servers

• C# - Activator method

• VBScript - CreateObject(("MetaFrameCOM.MetaFrameFarm", ServerName1)

• Event handling• Server, Application and Folder Events

• Create, update (rename), move and delete

• MetaFrameFarmEvent enum, IMetaFrameEventQueue, CreateEventQueue2 method in MetaFrameFarm

Page 29: Citrix Mfcom Programming For Administrators

29© 2007 Citrix Systems, Inc. — All rights reserved

Extra Credit : Printing

• List printer drivers on every server

• Use of MetaFrameServer and MetaFramePrinterDriver Methods

Page 30: Citrix Mfcom Programming For Administrators

30© 2007 Citrix Systems, Inc. — All rights reserved

Agenda

Agenda item number 1

MFCOM Basics

Start Using MFCOM

Labs In Action

Future and Takeaways

Page 31: Citrix Mfcom Programming For Administrators

31© 2007 Citrix Systems, Inc. — All rights reserved

CPSSDK

• Scalability • Highly scalable in large farm environment

• Usability• Consolidation of interfaces and methods

• Enhanced consistency in object behavior

• Easy multi-farm management

• Better .Net Support• .NET assembly

• .NET versioning and generics

Next-generation Presentation Server Management SDK

Page 32: Citrix Mfcom Programming For Administrators

32© 2007 Citrix Systems, Inc. — All rights reserved

How Does CPSSDK Work ?

IMACOM

IMA

LHC

DCOM

RPCSAL

SALSAL

Data Store

Data Collector

Citrix Presentation Server

Windows Machine

CPSSDKCPSSDKClientClient

Cached Cached DataData

Chunky Chunky CallsCalls

SAL : Subsystem Access Layer

Page 33: Citrix Mfcom Programming For Administrators

33© 2007 Citrix Systems, Inc. — All rights reserved

Work Smarter and Faster

Start Using MFCOM Today!

Page 34: Citrix Mfcom Programming For Administrators

34© 2007 Citrix Systems, Inc. — All rights reserved

Before you leave…

• Overall conference survey is available online at www.citrixiforum.com starting Wednesday, October 24 (please provide feedback)

• Download workshop materials from www.citrixiforum.com starting Monday, October 29

• Leftover workshops handouts can be found at the HOT Assistance Center Desk

Page 35: Citrix Mfcom Programming For Administrators

35© 2007 Citrix Systems, Inc. — All rights reserved

Page 36: Citrix Mfcom Programming For Administrators

36© 2007 Citrix Systems, Inc. — All rights reserved

Data Type: LMRuleSchedule

Bit 31-16 Bit 15-0

End time Start time

Bit 15-8 Bit 7-5 Bit 4 Bit 3-0

Hour (in military time format) Not used Half hour

Day of week