Solved

Moving print server, need to figure out how to map printers using a script.

Posted on 2008-10-15
13
482 Views
Last Modified: 2012-05-05
Thanks in advance for all your help. You guys are great. I know nothing about creating a script but we are moving the print server to another device. Currently the printers are listed in a directory. I would like to map all the printers using a script. In the AD logon script, there is a logon.cmd and in it points to a vbs of set drives. Can I also add a command to set printers and if so what would the script be.

For example all printers will be on \\server1\      
0
Comment
Question by:microsymplex
13 Comments
 
LVL 11

Accepted Solution

by:
jkarnes12 earned 500 total points
Comment Utility
If all of your end-users are already mapped to the correct printers on the orginal server, you can use this software:

http://www.fluentware.com/move_my_printers/downloads.htm

It migrates all of your end users printer to the new location seamlessly.
0
 
LVL 2

Expert Comment

by:mikef147
Comment Utility
This could possibly be a solution for you:

http://www.petri.co.il/changeprintsrv.htm
0
 

Author Comment

by:microsymplex
Comment Utility
After looking at how the printers were setup, it looks like I will have to manually add each printer to the new print server then add a script to mapp all the printers for everyone.
0
 
LVL 14

Expert Comment

by:igor-1965
Comment Utility
Correct, as the 1st step you have to add and share printers on the new server (let say \\PRINTServer1) and install printer drivers on this server. Suggest you name printers the same as it were named on the old print server (so the users won't be too confused by migration).

2nd step - you arrange login script to add this shared printer when the user logins to network.

I found that con2prt.exe utility (http://www.paulmcgrath.net/download.php?list.2) is very handy in login scripts. It can flush all the shared printers (con2prt.exe /f) and add another printers from the list.

The example is below (\\%LOGONSERVER%\Scripts$\PRINT\ is the folder where I saved con2prt.exe program and MyPrinters.lst):

\\%LOGONSERVER%\Scripts$\PRINT\con2prt.exe /f
for /f %%i in (\\%LOGONSERVER%\Scripts$\PRINT\MyPrinters.lst) do \\%LOGONSERVER%\Scripts$\PRINT\con2prt.exe /c %%i

MyPrinters.lst contains this lines:
\\PRINTServer1\HP9001
\\PRINTServer1\HP9002
\\PRINTServer1\HP9003

I hope it will help.
0
 
LVL 13

Expert Comment

by:rhinoceros
Comment Utility
For network printer mapping

(Logon.cmd example)

On error resume next
Set net = CreateObject("WScript.Network")
' Add new network printer
net.AddWindowsPrinterConnection "\\server1\HPLJ123"
net.AddWindowsPrinterConnection "\\server1\HPLJ890"

' Set default printer
net.SetDefaultPrinter "\\server1\HPLJ123"

'Also remove old printer link from users' profile
net.RemovePrinterConnection "\\server1\HPLJZZZ"


I hope it can help !
0
 
LVL 13

Expert Comment

by:rhinoceros
Comment Utility
Sorry ! it is "logon.vbs" not "logon.cmd"
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 13

Expert Comment

by:rhinoceros
Comment Utility
(Logon.cmd)
echo off
...
logon.vbs
...


(Logon.vbs)
On error resume next
Set net = CreateObject("WScript.Network")
' Add new network printer
net.AddWindowsPrinterConnection "\\server1\HPLJ123"
net.AddWindowsPrinterConnection "\\server1\HPLJ890"

' Set default printer
net.SetDefaultPrinter "\\server1\HPLJ123"

'Also remove old printer link from users' profile
net.RemovePrinterConnection "\\server1\HPLJZZZ"


***  It will call logon.vbs when you run logon.cmd on AD logon script

0
 
LVL 14

Expert Comment

by:igor-1965
Comment Utility
Sorry to say rhinoceros, but command processor is not Windows Explorer so logon.cmd won't call logon.vbs directly.
0
 
LVL 13

Expert Comment

by:rhinoceros
Comment Utility
Why not... it is not physically run on Windows Explorer... now placed to AD logon script.

I always do it by .bat or .cmd extension file to call .vbs file. It's worked.

Have you tried it ?
0
 
LVL 13

Expert Comment

by:rhinoceros
Comment Utility
You can create these 2 files on your local C: drive, and try to run it....

(logon.cmd)
hello.vbs
pause

(hello.vbs)
wscript.echo "Hello !"

What's result ?
0
 
LVL 14

Expert Comment

by:igor-1965
Comment Utility
Yes, on my XP home SP3 it works but it doesn't mean it is going to work on other Windows systems (as you can see they were not specified in the question) loging in to domain. Here is what Microsoft suggest how to run scripts from the Command Prompt: http://msdn.microsoft.com/en-us/library/ey73d9d3(VS.85).aspx
0
 
LVL 13

Expert Comment

by:rhinoceros
Comment Utility
Friend, we are able to use this method on almost windows systems -  Windows XP, 2000, 2003, and Vista... Have you also already tried it on those all Windows systems as you said ?

What's Microsoft suggest ? Do you think Microsoft must have the absolute answer ? The important is that it's work or not.

In the world, nobody can say that "it's absolute answer, no choice"... include Bill Gxxx, rite ?
0
 
LVL 14

Expert Comment

by:igor-1965
Comment Utility
Perhaps you are right and it will work on most of the Windows versions. But if you look under the "hood" you will see that Windows Explorer is doing it exactly per Microsoft documentation (see screen-shot). Rather than rely on Windows Explorer configuration (which might be changed by firm policies or screwed by the users) I prefer to do it straight.

But this is probably irrelevant to the original question. I have posted the script which is working in my office, you did for your office. It is up to microsymplex to choose what he feels the best way to go.

Clipboard01.jpg
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

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

9 Experts available now in Live!

Get 1:1 Help Now