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"
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
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
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,