Link to home
Start Free TrialLog in
Avatar of samiam41
samiam41Flag for United States of America

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?
Avatar of cantoris
cantoris
Flag of United Kingdom of Great Britain and Northern Ireland image

Can you show us some of the script?
ASKER CERTIFIED SOLUTION
Avatar of Lionel MM
Lionel MM
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of samiam41

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

Open in new window


This is the script that maps the printers based on their group AD membership.  I appreciate your help.
You're welcome.
Brilliant work!!