#167462 - 2006-09-11 06:56 PM
Seeking help to create a special script for printers
|
gdearborn
Fresh Scripter
Registered: 2006-09-08
Posts: 16
|
Here's the situation...Win2k3 Terminal server. Do not have to add printers as the box already has them installed. Any dynamic printers map thru a program by Tricerat (works great btw).
Windows loves to arbitrarily change the default printer on my users. Sometimes sensistive stuff goes all over the palce by accident. This is a big deal for us.
So what I was thinking of doing is writing a script that brings up a list box with all installed printers available and allow the user to choose their new default printer at logon on to the TS. I have some of the code written - sorta- and have not been able to find any simliar UDFs or forum topics on the matter.
I did find a great udf on listing the printers from Allen Powell. And I wrote my own list box "Array", but quite honestly feel over my head on this one.
Help would be much appreciated...plus we can post it for other people as I would think it is a fairly useful little script.
|
Top
|
|
|
|
#167465 - 2006-09-11 07:09 PM
Re: Seeking help to create a special script for printers
|
gdearborn
Fresh Scripter
Registered: 2006-09-08
Posts: 16
|
you said: why not always set the users default printer to correct one
because this is a terminal server supporting many physical offices, there really is no way to identify the correct one cept by user edict. Plus users roam from office to office so default today may not be right default tomorrow.
You said: if not possible, alert the user that default printer is not available
Well because they (the printers) are all installed at the Terminal Server, technically they are all available. But they hit print and it shows up in Chicago...Mostly because they forget (or don't bother) to verify what their default is (was). I hope I'm making sense...
Example...I'm working in the Orland Office. Tricerat maps my local printers to the TS as *** Orlando - Laserjet 1 ***. I make it my default. End of day I close my laptop and head to Chicago. Log and Tricerat maps my *** Chicago - Laserjet 1 ***. I hit print and it goes to Orlando. OOps.
I must mention that part of my problem is this bug in TS where the deafult printer seems to change without rhyme or reason.I have really beat that dead horse to death. No one has any answers but many people have same problem. I figured this script would require "minor" user intervention but dramatically improve my helpdesk call volume as the number one gripe we get is the default printer bug.
I hope that makes more sense...
|
Top
|
|
|
|
#167466 - 2006-09-11 07:13 PM
Re: Seeking help to create a special script for printers
|
gdearborn
Fresh Scripter
Registered: 2006-09-08
Posts: 16
|
No way to organize into groups...users roam from office to office. Machinename grouping won't work because remote offices are not part of domain. We went TS over VPN for that very reason...no bulky overhead domain traffic and expensive MPLS/Frame network.
|
Top
|
|
|
|
#167467 - 2006-09-11 07:29 PM
Re: Seeking help to create a special script for printers
|
gdearborn
Fresh Scripter
Registered: 2006-09-08
Posts: 16
|
...
|
Top
|
|
|
|
#167469 - 2006-09-11 08:48 PM
Re: Seeking help to create a special script for printers
|
gdearborn
Fresh Scripter
Registered: 2006-09-08
Posts: 16
|
IP might work (if grouped by subnets), but it would be very static not quite reliable, particularly at corp where there are many IP printers in same subnet and additionally, there would be a IP topo overhaul required to put each office on seperate subnet...
You did mention exactly what I want to do. I want to take your printer list UDF and modify it so that each "enumerated" printer makes a list choice in the list box, they simply choose the printer and the script sets the default...I already started working on the list box as follows...(idon't know how to do that nifty code snippet thing ya'll do)
-----
$root=createobject("KiXGUI.Desktop")
$frmSample=$root.createform("frmSample","Company",200,100,400,180) $Listbox=$frmSample.addlistbox("lstbox",20,40,250,100) $listbox.onchange="Lstbox_change" $=$frmSample.addlabel("lblBox","Please Select your desired default printer for this session...",7,10,400,30) $Listbox.additem("Printer1") $Listbox.additem("Printer2") $Listbox.additem("Printer3") $Listbox.additem("Printer4") $Listbox.additem("Printer5") $Listbox.additem("Printer5") $Listbox.additem("Printer6") $Listbox.additem("Printer7") $Listbox.additem("Printer8") $Listbox.additem("Printer9") $Listbox.additem("Printer10") $Listbox.additem("Printer11) $Listbox.additem("Printer12") $Listbox.additem("Printer13") $Listbox.additem("Printer14") $Listbox.additem("Printer15") $Listbox.additem("Printer16") $Listbox.additem("Printer17") $Listbox.additem("Printer18") $Listbox.additem("Printer19") $Listbox.additem("Printer20") $Listbox.additem("Printer21") $Listbox.additem("Printer22") $Listbox.additem("Printer23") $Listbox.additem("Printer24") $frmsample.visible=1
;while $frmSample.visible=1 $=execute($frmsample.lastevent) ;loop
;quit()
function Lstbox_change $frmsample.controls("txtBox").caption=$Listbox.item($Listbox.listindex) endfunction
$printerchoice=$Listbox.item($Listbox.listindex)
If SetDefaultPrinter ("\\Servername\$printerchoice") = 0 ? "Default Printer was successfully mapped to $printerchoice" Else ? "There was an error mapping your default printer." Endif
Exit
|
Top
|
|
|
|
#167470 - 2006-09-11 09:09 PM
Re: Seeking help to create a special script for printers
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Hey, makes me remind of Yet another printer script, the idea I had about providing the correct Windows printer depending on IP Address. Maybe the script can give you some ideas.
|
Top
|
|
|
|
#167471 - 2006-09-11 09:17 PM
Re: Seeking help to create a special script for printers
|
gdearborn
Fresh Scripter
Registered: 2006-09-08
Posts: 16
|
Sorry Witto...implementing by IP is just not going to be effective for us...however, if anyone wants to help me port Mr. Allen's printer list results into my good ole lis tbox here...I'm loving you.
|
Top
|
|
|
|
#167472 - 2006-09-12 01:17 AM
Re: Seeking help to create a special script for printers
|
gdearborn
Fresh Scripter
Registered: 2006-09-08
Posts: 16
|
crickets chirping....how about a more specific question...
how would one assign incrementing variables to the array so that each increment could be used to populate the list box.
I tried $Count = $Count +1 , but it its not quite doing what I'm looking for
looking for
$printer1 = ArrayValue1 $printer2 = ArrayValue2 etc..
any ideas...?
|
Top
|
|
|
|
#167473 - 2006-09-12 08:16 AM
Re: Seeking help to create a special script for printers
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Code:
If NOT @LOGONMODE Break On EndIf Dim $SO $SO = SetOption("Explicit","On") $SO = SetOption("NoMacrosInStrings","On") $SO = SetOption("NoVarsInStrings","On") $SO = SetOption("WrapAtEOL","On")
Dim $arrPrts[], $strPrt, $i, $j $i = -1 $arrPrts = Split("Prt1,Prt2,Prt3",",") For Each $strPrt In $arrPrts $i = $i + 1 $SO = Execute("Dim $Printer" + $i) $SO = Execute("$Printer" + $i + " = " + $strPrt) Next
For $j = 0 to $i step 1 $SO = Execute("? $Printer" + $j) Next
|
Top
|
|
|
|
#167474 - 2006-09-12 12:13 PM
Re: Seeking help to create a special script for printers
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Sorry for asking. - I do not get why you say Windows loves to arbitrarily change the default printer on your users. I never have seen issues about this. - Is it triCerat ScrewDrivers you are using? I'd like to know your experiences about this product.
|
Top
|
|
|
|
#167475 - 2006-09-16 04:50 AM
Re: Seeking help to create a special script for printers
|
gdearborn
Fresh Scripter
Registered: 2006-09-08
Posts: 16
|
It's not the Tricerat Software (which works wonderfully in a terminal env). It is in fact something about Windows 2003 server. I don't think everyone has the problem but there are certainly folks who do have it. We're one of them.
http://groups.google.com/group/microsoft...82541c0223223ff
this is a link to just one person who desscribes the problem in general terms its always the same ole story. The funny thing is that everyone I see posting the issue never gets a solution replied back. Mystery I suppose, but that leaves us to figure our own solutions until something happens. SP or whatever.
I did finish that script though and it works wonderfully. Really is a useful script but there didn't seem to be much interest in it (or maybe just helpng me...:P )
Thx for the post Witto..I had figured no one was going to help so I just basically beat the hell out of it until I figured how to do it.
Cheers
|
Top
|
|
|
|
#167476 - 2006-09-16 07:12 AM
Re: Seeking help to create a special script for printers
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
The link you gave is going to a thread in a forum. It is a question from someone and there are no answers. It is not something on the microsoft pages. I get the impression that the guy in that forum is just adding printer connections over and over again but not setting default printers. If I would add printers via login script I would check a few things: 1. check if the printers the person needs are already installed 2. if not installed, just add the printers the person needs 3. check if the right default printer has been set 4. if not set, set the right default printer The checks will speed up the login script. Jooel wrote his PriMapState that helps you to know if a printer has been added and if it is the default printer. Just thinking about a possible implementation: Code:
Dim $SO If NOT PrimapState($Printerx) > 0 $SO = AddPrinterConnection($Printerx) EndIf If NOT PrimapState($Printery) > 0 $SO = AddPrinterConnection($Printery) EndIf If NOT PrimapState($Printerz) > 0 $SO = AddPrinterConnection($Printerz) EndIf If NOT PrimapState($Printerx) = 2 $SO = SetDefaultrinter($Printerx) EndIf
Hope this can be of any use to you.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 369 anonymous users online.
|
|
|