Page 1 of 1 1
Topic Options
#21301 - 2002-05-07 09:23 PM Problem with defautl printer
Duncan Bachen Offline
Fresh Scripter

Registered: 2002-05-07
Posts: 5
I tried reading through the rest of the topics on this (and there was one just a few below this), but no matter what I do, my SetDefaultPrinter always returns 2, and will not set.

Setup:
-Windows 2000 Server (CITRIX1)
-Standard TCPIP Port created to 192.168.6.102
-Created a local printer using that port and named it "OHS MIS LJ2100"

I've tried the following syntax(s)
1) SetDefaultPrinter("\\CITRIX1\OHS MIS LJ2100")
That should have worked based on the documentation, so then I just started trying ANYTHING.
2) SetDefaultPrinter("\\CITRIX1\192.168.6.102")
I then tried sharing the printer (which I shouldn't need to do, as "OHSPRTRLR")
3) SetDefaultPrinter("\\CITRIX1\OHSPRTRLR")

None of the above work.
So now I'm doing a convoluted registry hack to get it to write to the Device key the name of the printer.
If InGroup("OHS Accounting")
$MyDefaultPrinter = "OHS MIS LJ2100,winspool,Ne24:"
EndIf



; Store the default printer in the registry
WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device",$MyDefaultPrinter, "REG_SZ")

So i'm writing the key directly by first manually setting the default printer, checking the registry entry, and then copying/pasting the key into the KixScript. It's referring to it by the same name as the defaultprinter though, which is the wierd thing.

Any thoughts?

I could really use some help on this one.

-Duncan

Top
#21302 - 2002-05-07 09:50 PM Re: Problem with defautl printer
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
i'm assuming you just try to have a workstaion connect to the printer on the server?
Normally, you share the printer on the server, do a ADDPRINTERCONNECTION on the client and then you cna do a SETDEFAULTPRINTER on the client. Now, this is in a simple domain setup, I'm not sure whether you are trying to use Citrix-specific stuff. Give this a try in your login script:
code:
$retcode=AddPrinterConnection("\\CITRIX1\OHSPRTRLR")
? @ERROR+' - '+@SERROR
$retcode=SetDefaultPrinter("\\CITRIX1\OHSPRTRLR")
? @ERROR+' - '+@SERROR

_________________________
There are two types of vessels, submarines and targets.

Top
#21303 - 2002-05-07 10:00 PM Re: Problem with defautl printer
Duncan Bachen Offline
Fresh Scripter

Registered: 2002-05-07
Posts: 5
The problem is understanding how a Citrix (Terminal Services) login works:

1) The client runs the software to connect to the Citrix machine
2) They actually *login* to the server, as if they physically walked up and sat down at it.
3) Any application that they run is actually running on the Citrix Server.

So in my case, I have users in a remote office that connect and run an application.
-The printer that they want to print to is actually located in their department.
-I need to make the Citrix server aware that this printer exists, which I do using the aforementioned Standard TCPIP Port
-I have to manually add all the possible printers to the Citrix Server, and using the UsrMgr give access to certain people based on their group membership.
-If they run the application, they see all the *local printers* on the Citrix machine. This is kind of misleading, because those local printers are actually redirected to network IP ports, but that's beside the point. They see whatever their group membership lets them see.
-Depending on which department they are coming from however, I need to be able to set their default printer to be equal to one of those local printers.

So basically I'm trying to reference a printer that's attached to the same machine as the one that's running the Kix script.

quote:
i'm assuming you just try to have a workstaion connect to the printer on the server?
Normally, you share the printer on the server, do a ADDPRINTERCONNECTION on the client and then you cna do a SETDEFAULTPRINTER on the client. Now, this is in a simple domain setup, I'm not sure whether you are trying to use Citrix-specific stuff. Give this a try in your login script:

code:
--------------------------------------------------------------------------------

$retcode=AddPrinterConnection("\\CITRIX1\OHSPRTRLR")? @ERROR+' - '+@SERROR$retcode=SetDefaultPrinter("\\CITRIX1\OHSPRTRLR")? @ERROR+' - '+@SERROR


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 611 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.049 seconds in which 0.022 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org