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

advertisement

Modifying a cirtix printer policy, in the Scripting / Automation forum on BrianMadden.com

rated by 0 users
This post has 2 Replies | 1 Follower

Not Ranked
Points 25
strutts humming Posted: 11-21-2008 6:49 AM

HI there,

 

I have been working on a VB script recently that will create a new citrix printer policy. Although I managed to get it to work, and make a couple of changes to the policy I am having trouble modifying it further.

 

What I cant seem to figure out is how to:

 

1. Change the clients default printer to the one I have added to the policy.

2. Configure the printer to change its paper size setting

3. Apply the policy to an AD group.

 

Here is what I have so far:

 

strPrinter = "SomePrinter"

' Create MetaFrameFarm object

Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")

 

if Err.Number <> 0 Then

            MsgBox "Can't create MetaFrameFarm object"

            Wscript.quit

End If

 

theFarm.Initialize(MetaFrameWinFarmObject)

 

If Err.Number <> 0 Then

            MsgBox "Can't Initialize MetaFrameFarm object"

            Wscript.quit

End If

 

Set myPolicy = theFarm.CreatePolicy(MetaFrameUserPolicyObject, "My Policy" , "CTX Printing Policy")

myPolicy.UserPolicy.SessionPrintersRule = MFPolicyEnabled

myPolicy.SaveData()

 

Set u = myPolicy.SessionPolicy2

Set PrinterCollection = CreateObject("MetaFrameCOM.MetaFramePrinters")

Set Printer = CreateObject("MetaFrameCOM.MetaFramePrinter")

Set pCred = CreateObject("MetaFrameCom.MetaFrameCredential")

 

pCred.Initialize "UserName", "PassWord", 2, "Domain", 1

Printer.InitConnection strPrintServer, strPrinter, pCred

PrinterCollection.AddPrinter Printer

u.PrinterConnections = PrinterCollection

myPolicy.SaveData

Many thanks,

SH

  • | Post Points: 20
Top 75 Contributor
Points 1,855

You could try this thread:

http://www.brianmadden.com/blogs/guestbloggers/archive/2007/12/06/vb-script-to-backup-restore-cps-policies.aspx

Edit the XML with a vbs script and then upload using the Backup/Resore Script.

--Emil

  • | Post Points: 20
Not Ranked
Points 25

Cool, thanks for the link. It was a great help.

However, although I have managed to configure a specific AD account I cannot make my script to thick the box “Filter based on users”.

I think its got something to do with setting and saving the loadFilterData flag, but I cannot seem to get it to work.

Any help will be grateful.

Thanks again,

SH

 

 

  • | Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 1997-2008 The Brian Madden Company, LLC | Disclosures | Privacy | Terms of Use | Contact Info