Experience the new look and feel.
The following example allows citrix admins to import previously exported printer settings (.dat file) and then launch an application with the imported settings. Note: this example script requires prnadmin.dll from the windows 2003 resource kit which must be registered prior to running the vbscript.
Citrix | Windows past script from window below and name importandrun.vbs to run, either double click on the file or type in cscript importandrun.vbs from command line.
dim oMaster,filename,Flags,PrinterName Set objShell = CreateObject("Wscript.Shell") Set objNetwork = Wscript.CreateObject("WScript.Network") set oMaster = CreateObject("PrintMaster.PrintMaster.1") Flags=16 'Previously saved dat file containing the printer settings. Filename="c:\previouslysaved.dat" PrinterName="\\printsvr\hp laserjet 4000" 'Necessary for the restore 'Adds a printer connection to a print server not a local printer Wscript.Echo "Adding Printer" objNetwork.AddWindowsPrinterConnection ("\\printsvr\printerconnection1") 'Valid for local or remote printers Wscript.Echo "setting the default printer" objNetwork.SetDefaultPrinter("\\printsvr\printerconnection1") ' The driver name, not share name, needed for the restore to function correctly Wscript.Echo "Restoring printer settings from c:\previouslysaved.dat" oMaster.PrinterPersistRestore PrinterName, FileName, Flags Wscript.echo "Launching the application" objShell.Run ("notepad.exe c:\usr\document.txt"),1,True Wscript.Echo "now removing printer" objNetwork.RemovePrinterConnection ("\\printsvr\printerconnection1")