?
Solved

Stop Network Printers From Roaming

Posted on 2005-05-02
8
Medium Priority
?
736 Views
Last Modified: 2008-02-01
I have searched Windows 2003 AD for a way to prevent network printers from roamming, but have been unsuccessful.  We have many roaming profile users.  I have installed a log-on script that maps network printers based on a user's geographic area, however, they still print to wrong printers due to their printers following them.  Is there a way to prevent printers from roaming?  If not, does anyone know of a script to "batch disconnect" all network printers (not one at a time like kixtart's DelPrinterConnection or Windows' rundll32 printui.dll,PrintUIEntry /dn)?  The later programs require you to know the name of the network printer to disconnect it.  I want to delete all network printers and assign the ones I want with my log-on script.

Thanks much!
Terry
0
Comment
Question by:SCTCIT
8 Comments
 
LVL 15

Expert Comment

by:scampgb
ID: 13911459
Hi SCTCIT,
I've found a script at http://techrepublic.com.com/5208-6239-0.html?forumID=57&threadID=171021 that should help you with this.

This script will delete your connection to all of the printers, by enumerating them first. I've not tried it myself though.

Any help?
0
 
LVL 51

Expert Comment

by:Netman66
ID: 13911533
No, Network printers are profile-based.  If the user's profile roams, so does the printer.

We have removed this issue by installing printers local to the PC rather than per user.


0
 

Author Comment

by:SCTCIT
ID: 13912080
Thanks, scampqb.  I tried the scripts, but they did not work.  A bunch of dialog boxes popped up that require you to click OK.

Netman66:  What scripting tool do you use to install them locally to the PC?  Could you post a sample of your script here?

Thanks!
0
Independent Software Vendors: 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!

 
LVL 15

Expert Comment

by:sr75
ID: 13912959
Network Printers are profile based, but you can delete them off and re-establish them based on Computer or Computer Groups as well.  

This script works for me to delete all the network printers:

<><>begin script<><>
On error Resume Next

Dim objNetwork
Dim strComputer

strComputer="."
Set Net = CreateObject("WScript.Network")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters =  objWMIService.ExecQuery("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters
      Printer = objPrinter.name
      Net.RemovePrinterConnection Printer
next
<><>end script<><>


This script will produce the computer group:


<><>begin script<><>

On Error Resume Next

set ADSysInfo = Createobject("ADSystemInfo")
set strComputer = GetObject("LDAP://" & ADSysInfo.ComputerName)
strgroup = LCase(strComputer.MemberOF)

wscript.echo strgroup
<><>end script<><>

Combine those two scripts with a couple of arrays (groups, and printers), as well as a do until x = y loop with a If InStr(strgroup, group) then arguement and you will have it.  Let me know if you need any help with that.  Of course you would have to place all your computers into groups that respect of their location.
0
 
LVL 15

Assisted Solution

by:sr75
sr75 earned 500 total points
ID: 13913049
Well I decided to be nice and wrote it out for you anyways (its a vbscript by the way):

<><>begin script<><>
On error Resume Next

Dim Net
Dim strComputer

grp = array("group0", _
            "group1", _
            "group2", _
            "group3")

prt = array("\\Server\Printer0", _
            "\\Server\Printer1", _
            "\\Server\Pritner2", _
            "\\Server\Printer3")

strComputer="."
Set Net = CreateObject("WScript.Network")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters =  objWMIService.ExecQuery("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters
     Printer = objPrinter.name
     Net.RemovePrinterConnection Printer
next

set ADSysInfo = Createobject("ADSystemInfo")
set CompName = GetObject("LDAP://" & ADSysInfo.ComputerName)
strgroup = LCase(CompName.MemberOF)

x = 0

Do until x = 4
      If InStr(strgroup, grp(x)) then
            Net.AddWindowsPrinterConnection prt(x)
      end if
      x = x + 1
loop
<><>end script<><>
0
 
LVL 85

Accepted Solution

by:
oBdA earned 500 total points
ID: 13913104
con2prt.exe from the Zero Administration Toolkit (NT4, but still runs fine on XP) will do that.
simply start it with "/f" as argument, that will delete all mapped network printers.

How to Use Con2prt.exe to Connect to a Network Printer
http://support.microsoft.com/?kbid=181663

Zero Administration Kit
http://www.microsoft.com/ntworkstation/downloads/Recommended/Featured/NTZAK.asp
0
 
LVL 51

Expert Comment

by:Netman66
ID: 13913658
Well, see the above!  Those look fine.

0
 

Expert Comment

by:m0bov
ID: 13926712
Add them as a local printer with a TCP IP port rather then LPT1, it will print over the network but as its shown as local, it won't roam.

James
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Loops Section Overview

757 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