#200330 - 2010-10-21 11:45 PM
Windows 7 printer scripting
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
Hi,
I used kix script for about 6 years on our server 2003 and xp clients to map user printers based on whether they belong to an AD group or not. I also set default printers that way. Last year, we upgraded to Server 2008R2 and Windows 7 and my old faithful script stopped working because the end users didn't have permissions to install printers. I changed my network setup and started deploying printers with Group policy. I have found GPO deployment really intermittent, some days it works and works well and other days not. Sometimes printers are deployed properly. The main glitch however is that often the default printer is set incorrectly.
Can anyone recommend how I can amend my kix script so that it deploys printers without prompting for admin rights at the workstation?
Regards
Edited by Devlin7 (2010-10-21 11:46 PM)
|
|
Top
|
|
|
|
#200331 - 2010-10-21 11:48 PM
Re: Windows 7 printer scripting
[Re: Devlin7]
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
The old script looked like this
; ************************************************************************************************************************************************
; * Printer mapping
; ************************************************************************************************************************************************
if LEFT(@WKSTA,3)="LAP"
open(5,$ldrive+"ptrlist.txt",2)
while $errorptr=0
$printer=readline(5)
$errorptr=@error
$ptr="ptr"+$printer
$ptrold="\\Raja\"+$printer
$ptrmap="\\Saucha\"+$printer
if ingroup($ptr)
delprinterconnection($ptrold)
addprinterconnection($ptrmap)
$ptd="ptd"+$printer
if ingroup($ptd)
setdefaultprinter($ptrmap)
endif
else
delprinterconnection($ptrmap)
endif
loop
close(5)
endif
Edited by Mart (2010-10-22 09:06 AM) Edit Reason: Please use code tags when posting code.
|
|
Top
|
|
|
|
#200333 - 2010-10-21 11:58 PM
Re: Windows 7 printer scripting
[Re: Les]
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
Yes. This would be true but it becomes messy. If at any point a new printer driver is added throughout the year I would have to added it via GPO prior to scripting it. If the script tries to add it before GPO then the user will be prompted and they will be stuck. If they exit the script they get logged off.
|
|
Top
|
|
|
|
#200334 - 2010-10-21 11:59 PM
Re: Windows 7 printer scripting
[Re: Devlin7]
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
The other catch about adding printers is that the printers must be added with ADMIN rights but the addition of the printer must in fact before the user and not the admin person. [ie run as is not an option]
|
|
Top
|
|
|
|
#200337 - 2010-10-22 01:25 AM
Re: Windows 7 printer scripting
[Re: Glenn Barnas]
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
Thanks. Been there and done that. We have a number of Xerox copier drivers that aren't certified and so the used still gets prompted.
|
|
Top
|
|
|
|
#200339 - 2010-10-22 01:39 AM
Re: Windows 7 printer scripting
[Re: Les]
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
No you are right, this is NOT a kix problem. I just thought that there might be a work around. The problem is that Xerox drivers for our site didn't work, in fact they were incredibly unstable. The copiers are quite old and Xerox have no intention of fixing the issue properly. They however issued a few patch drivers that were not digitally signed. The group policy changes mentioned above work well for digitally signed drivers but prompt users if they aren't digitally signed.
I just thought there might be a way from a kix script to run the addprinter command with admin rights so that the end user get the printer installed.
|
|
Top
|
|
|
|
#200340 - 2010-10-22 01:42 AM
Re: Windows 7 printer scripting
[Re: Devlin7]
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
Oh and before you suggest replacing the copiers, this is not an option as some moron signed a 5 year lease on the gear
|
|
Top
|
|
|
|
#200342 - 2010-10-22 02:13 AM
Re: Windows 7 printer scripting
[Re: Les]
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
Thanks Les. The great thing about KIX is that I could assign printers depending on AD groups. I can do the same thing via Group policy but it is nowhere as reliable as kix was. I guess I will just have to keep hassling Xerox for an MS approved driver. Thanks for your help!
|
|
Top
|
|
|
|
#200345 - 2010-10-22 03:20 AM
Re: Windows 7 printer scripting
[Re: Allen]
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
Our Xerox copiers have been crashing our terminal servers all year. At one point early this year, we were getting four crashes per server per day. It doesn't take long before your server doesn't come back up again, I can tell you. There is nothing like 80-100 users go offline at once! We are nearly 10 months along and little has been done by Xerox. Luckily, the American have produced a Windows 2008R2 compatible global driver but this only fixes half our issues. I am planning for next years rollout and honestly don't know what do do about half our copiers. I keep telling management to take Xerox to court but they have more money than us!
Edited by Devlin7 (2010-10-22 03:47 AM)
|
|
Top
|
|
|
|
#200346 - 2010-10-22 03:25 AM
Re: Windows 7 printer scripting
[Re: Devlin7]
|
Devlin7
Fresh Scripter
Registered: 2010-10-21
Posts: 13
Loc: NZL
|
Allen. Thanks for the post but the contents were a major whoosh, like way over my head!
|
|
Top
|
|
|
|
#200348 - 2010-10-22 04:21 AM
Re: Windows 7 printer scripting
[Re: Devlin7]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Its really not that complicated. Paste the function to the bottom of your GPO script. Then you would have your GPO script to do things that require admin privs, and then at the end of the GPO script you would add the example lines to run another script using the function.
Something like.
;GPO script
;...code
;...code
;
;Insert example code below
if instr(@producttype,"Vista") or instr(@producttype,"Windows 7")
$RC=RunAsInteractiveUser(@scriptdir + "\kix32.exe", @scriptdir + "\mapdrives.kix")
? @serror
endif
;
;Paste Function at the bottom of the script
function RunAsInteractiveUser
;...
endfunction
How to use UDFs - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943
|
|
Top
|
|
|
|
#200362 - 2010-10-23 08:15 PM
Re: Windows 7 printer scripting
[Re: Allen]
|
Shanee
Fresh Scripter
Registered: 2006-10-13
Posts: 39
Loc: Tulsa, OK
|
I actually wrote a small script just for that once. Used it to connect to all printers on our print server whenever we built a new citrix server. That way all the drivers got installed. The Ricoh aficio printers were nasty as well if I remember correctly.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 657 anonymous users online.
|
|
|