Solved

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

Posted on 2014-01-23
5
726 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:cantoris
ID: 39805895
Can you show us some of the script?
0
 
LVL 25

Accepted Solution

by:
Lionel MM earned 500 total points
ID: 39806397
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
ID: 39820871
@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 25

Expert Comment

by:Lionel MM
ID: 39824564
You're welcome.
0
 
LVL 9

Author Closing Comment

by:samiam41
ID: 39851344
Brilliant work!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

630 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