Solved

Delete printer on PC pointing to old print server using login script

Posted on 2014-01-23
5
694 Views
Last Modified: 2014-02-11
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?
0
Comment
Question by:samiam41
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:cantoris
Comment Utility
Can you show us some of the script?
0
 
LVL 24

Accepted Solution

by:
lionelmm earned 500 total points
Comment Utility
This tells you how to do it from a command line but this can simply be added to your current printers.bat--this will actually remove the installed printers on the PC. If however you are simply wanting to remove the mapping you can do so by using net use and the /d (delete command. http://www.ehow.com/how_6025485_remove-printers-command-line.html
0
 
LVL 9

Author Comment

by:samiam41
Comment Utility
@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.
0
 
LVL 24

Expert Comment

by:lionelmm
Comment Utility
You're welcome.
0
 
LVL 9

Author Closing Comment

by:samiam41
Comment Utility
Brilliant work!!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now