Solved

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

Posted on 2014-01-23
5
709 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

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 …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
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…

860 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