samiam41
asked on
Delete printer on PC pointing to old print server using login script
Greetings EE! I am migrating the print service from a Windows 2003 server to a Windows 2008 server. The print queue migration is nearing completion but one piece needs to be worked through. Our users get their printers via a printer mapping script (printer.bat) called during the running of the login script.
**Edited**
To make this a little easier, how can I delete out the printers that are installed on the users PC that point to the old print server?
**Edited**
To make this a little easier, how can I delete out the printers that are installed on the users PC that point to the old print server?
Can you show us some of the script?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@echo off
setlocal enabledelayedexpansion
REM echo Removing existing printers...
REM cscript %windir%\system32\prnmngr.vbs -x
echo Connecting Printers...
set PriorityDefaultPrinterSet=0
for /f "tokens=1-3 delims=-." %%a in ('n:\ifmember.exe /list ^| find /i "group %UserDomain%\Prt-" ^| sort') do (
echo Connecting %%b %%c
rundll32 printui.dll,PrintUIEntry /in /q /n\\oldprintserver\%%b
if not "!PriorityDefaultPrinterSet!" == "0" goto not_def
echo ...Setting as default printer
rundll32 printui.dll,PrintUIEntry /y /n\\oldprintserver\%%b
:not_def
if /i "%%c"=="D" set PriorityDefaultPrinterSet=1
)
:end
This is the script that maps the printers based on their group AD membership. I appreciate your help.
You're welcome.
ASKER
Brilliant work!!