Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-01-23
5
Medium Priority
?
745 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 26

Accepted Solution

by:
Lionel MM earned 2000 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 26

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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

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…
There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
Suggested Courses

972 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