Re: Logon script for printers
From: Oli Restorick [MVP] (oli_at_mvps.org)
Date: 02/09/05
- Next message: Michael Harris \(MVP\): "Re: edit NAT portmapping item under "Windows Server 2003" ?"
- Previous message: J Ford: "RE: Splitting a text file"
- In reply to: Springside: "Logon script for printers"
- Next in thread: Eng: "RE: Logon script for printers"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 9 Feb 2005 21:53:01 -0000
Hi Vince
Here's how I do it.
Create a batch file (e.g. printers.bat) containing lines of the following
form (the PrintUIEntry bit is case-sensitive):
rundll32 printui.dll,PrintUIEntry /in /n \\printserver\printer1
rundll32 printui.dll,PrintUIEntry /in /n \\printserver\printer2
rundll32 printui.dll,PrintUIEntry /in /n \\printserver\printer3
Create a new group policy object and link it to the OUs where the user
objects reside. Navigate down through User Configuration | Windows Settings
| Scripts (Logon/Logoff).
Configure a logon script policy. Click the "Show Files" button to bring up
a Windows Explorer dialogue and copy your batch file to this directory.
Doing it this way ensures that the script will reside on all DCs (important
for resiliency). Click the "add" button and type "printers.bat".
This will run the script each time a user logs on.
For some reason, while connecting to the printers is very rapid for Windows
2000 clients, it takes a little longer for Windows XP clients. Here's a
little trick I use. I don't know if it will work well for your environment
or not.
At the top of the printers.bat file, paste the following:
-------------
@echo off
If not exist "%userprofile%\printers.ver" set old=none&goto record
for /f "Tokens=*" %%a in ('type "%userprofile%\printers.ver"') do (
set old=%%a
)
:record
for /f "Tokens=*" %%a in ('dir %~dp0^|findstr /L /I /c:"printers.bat"') do (
set new=%%a
)
if "%old%"=="%new% " goto end
echo %new% > "%userprofile%\printers.ver"
--------------
At the bottom of the file, add a line that contains :end (colon end).
What this does is to look for a text file called printers.ver in the user's
profile. This contains the date stamp for the printers.bat file. If the
date stamp in the file is different to that of printers.bat (or the
printers.ver file isn't present), the printers get added and the
printers.ver file is updated. If the dates are the same, the batch file
skips to the end and doesn't add the printers. This way, whenever you
update the printers.bat file, clients will get the updates at login. If you
haven't changed the batch file recently, the batch file does nothing.
As with all these things, test things out on a small test OU first to be
sure that everything's working. All the above assumes your client machines
are Windows 2000 or higher.
Hope this helps
Oli
"Springside" <Springside@discussions.microsoft.com> wrote in message
news:95607B71-ECBF-4C09-9B07-FAC6A2CBDBCC@microsoft.com...
> Hello,
>
> A couple of scritping questions for a novice, I am currently running
> Windows
> 2000 Server, where can I find a script to add printers for all users in
> Active Directory? Once I locate a script how do I deploy it to OU's in
> Active Directory?
>
> Thanks in Advance!
> Vince
- Next message: Michael Harris \(MVP\): "Re: edit NAT portmapping item under "Windows Server 2003" ?"
- Previous message: J Ford: "RE: Splitting a text file"
- In reply to: Springside: "Logon script for printers"
- Next in thread: Eng: "RE: Logon script for printers"
- Messages sorted by: [ date ] [ thread ]