Rename Printers in logon for Windows Server 2003, with VBScript

160 pts.
Tags:
Login scripts
VBScript
Visual Basic Script
Windows Server 2003 R2
Windows XP Professional SP3
Hi peeps!

Another question! This has been buggin me for a while.

Right, I have a Windows Server 2003 SP2 domain (Not R2) and i have about 90 Windows XP professional SP3 clients. Now I have at least 3 printers that are being shared. The printer share names are:

printer2

printer3

printer4

when staff and student log in they dont get "printer2" "printer3" and "printer4" in printers and faxes window,

it comes up with

"Brother HL-4040cn on server"

"NRG MP C2500 on server"

etc...

Here's my script

 

------------------------------------------------

 

// Declare All variables Option Explicit

'// Comment this out for debugging! On Error Resume Next

'// Variables Dim network, filesys, shell Dim printer2, printer3, printer4, serverpath, servername

'// Create Windows Scripting Object Set network = CreateObject("WScript.Network") Set filesys = CreateObject("Scripting.FileSystemObject") Set shell = CreateObject("WScript.Shell")

'// Define UNC Paths servername = "pvserver" serverpath = "" & servername & "" printer2 = serverpath & "Printer2" printer3 = serverpath & "Printer3" printer4 = serverpath & "Printer4"

'// Dont run on the server! If LCase(network.ComputerName) = servername Then   err.Raise1, "Can not run on the server!" End If

'// Map Printers network.AddWindowsPrinterConnection printer2 network.AddWindowsPrinterConnection printer3 network.AddWindowsPrinterConnection printer4

'// Set default printer network.SetDefaultPrinter printer2

'// map network drives network.MapNetworkDrive "s:", serverpath & "software" network.MapNetworkDrive "o:", serverpath & "Pupil Resources" network.MapNetworkDrive "z:", serverpath & "Media" network.MapNetworkDrive "G:", serverpath & "Sherston"


-----------------------------------

Can anyone rewrite this so you can make it say "printer2" "printer3" "printer4" in printers and faxes in peoples logins?

I'm ripping my hair out :-)

many thanks

Phil



Software/Hardware used:
Windows Server 2003 SP2, Windows XP Profesional SP3

Answer Wiki

Thanks. We'll let you know when a new response is added.

Best I can tell you is go to the server and change the share as name to printer1, printer2, printer3, etc. Then your users will see printer1 on server, printer2 on server, etc. As long as he printer is a shared printer in a windows network you will have the “on servername” appened to the printer name. If they are standalone printers on the netwokr not controlled by a print server then you can go chane the name on the printer itself and you will get the result you want

—————

AFAIK, changing the share name won’t help (and I think Philcrox already did that). The share name is what users will see if they navigate to the remote server, but the name they see in their machines will depend on the printer name on the server, not on the share name.

To rename a local printer one could use the RenamePrinter WMI method, but if you try to run it against a remote printer you will get an ‘invalid printer name’ error as result.

The closest I think you can get to what you want would be renaming the printer on the server, so your users will see the name as “printer1 <b>on server</b> as Spadasoe stated above”

-CarlosDL

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following