#211870 - 2016-08-10 10:38 PM
Looking for help with SETDEFAULTPRINTER and INGROUP
|
RyanASP
Just in Town
Registered: 2016-01-29
Posts: 3
Loc: South Charleston, WV
|
Here's my script:
? "Adding Printers"
IF $Printerlist <> ""
$Printerarray = SPLIT($Printerlist, ",", -1)
For each $printer in $printerarray
IF @INWIN = 1
IF ADDPRINTERCONNECTION("\\$Printserver\$printer") = 0
? "Successfully added printer: $printer"
ENDIF
IF INGROUP("TS $printer")
IF SETDEFAULTPRINTER("\\$Printserver\$printer") = 0
? "Default printer set to: $printer"
ENDIF
ENDIF
ENDIF
Next
?
ENDIF
? "End Printer Add"
We recently moved from a 2003 server to a 2012...both on our domain and terminal server. The script goes through and adds the servers just fine, but keeps defaulting all users to the same printer no matter which group they are in. It almost "feels" like it's not seeing their group membership. I added an ENUMGROUP and sure enough, it comes back with nothing. The ENUMGROUP bit I added was actually the example from the manual, and it returns nothing at all. The users know how to set their default printer and choose off the print dialog list, but it's frustrating to say the least. Anyone have any help?
Edited by Allen (2016-08-10 10:45 PM)
|
|
Top
|
|
|
|
#211871 - 2016-08-10 10:53 PM
Re: Looking for help with SETDEFAULTPRINTER and INGROUP
[Re: RyanASP]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4574
Loc: USA
|
I always forget whether the setdefault, addprinter, and delprinter functions need the share name, the printer name, or whatever. Many around here religiously name the printers and the share name, the exact same thing so that it is not an issue. Personally, I like using the share name and wrote a function to get around not being able to do this. Your choice, but I would start in these two places.
PrinterConnection has the ability to add, del, set and determine the default printer, all using the same share name. Examples are in the header of the UDF.
PrinterConnection - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=203840#Post203840
How to use UDFs - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943
The rest of the UDFs are here - http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1
_________________________
(... better days ahead)
|
|
Top
|
|
|
|
#211873 - 2016-08-11 09:38 AM
Re: Looking for help with SETDEFAULTPRINTER and INGROUP
[Re: Lonkero]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
At the beginning of the printers script add this line:
$=WriteValue('HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows','Device','winspool,Ne00:')
This removes the current default printer. Also, check for @ERROR after this line, if there is an @ERROR then the permissions on that registry setting is wrong causing your initial problem.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1202 anonymous users online.
|
|
|