Page 1 of 2 12>
Topic Options
#200330 - 2010-10-21 11:45 PM Windows 7 printer scripting
Devlin7 Offline
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 Offline
Fresh Scripter

Registered: 2010-10-21
Posts: 13
Loc: NZL
The old script looked like this

 Code:
; ************************************************************************************************************************************************
; * 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
#200332 - 2010-10-21 11:54 PM Re: Windows 7 printer scripting [Re: Devlin7]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I would think that once a printer got deployed by GPO, the drivers would be there and a subsequent KiX deployment would no longer fail.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#200333 - 2010-10-21 11:58 PM Re: Windows 7 printer scripting [Re: Les]
Devlin7 Offline
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 Offline
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
#200336 - 2010-10-22 01:18 AM Re: Windows 7 printer scripting [Re: Devlin7]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Review this technet article for using a GPO to alter the security to allow unsigned printer drivers to be installed by a non-admin user. This worked in one of our sites where we're using W2K8r2.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#200337 - 2010-10-22 01:25 AM Re: Windows 7 printer scripting [Re: Glenn Barnas]
Devlin7 Offline
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
#200338 - 2010-10-22 01:27 AM Re: Windows 7 printer scripting [Re: Devlin7]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: Devlin7
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.
Well... it's not a KiX problem. KiX has no secret sauce to get by that. You will have to change the security as Glenn mentioned.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#200339 - 2010-10-22 01:39 AM Re: Windows 7 printer scripting [Re: Les]
Devlin7 Offline
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 Offline
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
#200341 - 2010-10-22 02:06 AM Re: Windows 7 printer scripting [Re: Devlin7]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: Devlin7

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.
You cannot elevate perms at the time of a user logon because printers are installed "per user". The only thing you can do is to install the printer via GPO startup script that runs before logon.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#200342 - 2010-10-22 02:13 AM Re: Windows 7 printer scripting [Re: Les]
Devlin7 Offline
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
#200343 - 2010-10-22 02:27 AM Re: Windows 7 printer scripting [Re: Devlin7]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If you want to have something to really complain about, that would be Xerox printer drivers on a Citrix farm. Borking up a few PCs with a Xerox driver is one thing... messing up the Citrix farm is yet another.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#200344 - 2010-10-22 02:56 AM Re: Windows 7 printer scripting [Re: Les]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
 Quote:

The only thing you can do is to install the printer via GPO startup script that runs before logon.


Wouldn't this also run in the context of an admin user, ie I'm thinking in the lines of how mapped drives do not populate properly when using a GPO script.

I doubt this would help for the unsigned drivers problem, but I've been working on a script to assist the GPO script with things like mapped drives and printers so that it runs in the context of the user. It's been tested some and so far it seems to work. If it's any use to you, I'd appreciate you commenting on it.

RunAsInteractiveUser / LaunchApp.wsf Conversion Testing
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Main=26830&Number=198514

Top
#200345 - 2010-10-22 03:20 AM Re: Windows 7 printer scripting [Re: Allen]
Devlin7 Offline
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 Offline
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 Administrator Offline
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.

 Code:
;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
#200349 - 2010-10-22 04:26 AM Re: Windows 7 printer scripting [Re: Allen]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: Allen
 Quote:

The only thing you can do is to install the printer via GPO startup script that runs before logon.


Wouldn't this also run in the context of an admin user...
Yes, it is true, but when installed to the admin profile the drivers get installed. Later, during the logon script the non-admin user doesn't get prompted to install the driver since it was previously installed.

We do it all the time, install the printer as admin so that regular users can later install on their profile.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#200351 - 2010-10-22 04:52 AM Re: Windows 7 printer scripting [Re: Les]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
I see... cool. Makes perfect sense.
Top
#200362 - 2010-10-23 08:15 PM Re: Windows 7 printer scripting [Re: Allen]
Shanee Offline
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
Page 1 of 2 12>


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

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.084 seconds in which 0.033 seconds were spent on a total of 13 queries. Zlib compression enabled.

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