Connecting Tech Pros Worldwide Help | Site Map

Map printer by IP address in logon script

rcollins's Avatar
Familiar Sight
 
Join Date: Aug 2006
Location: Grand Junction, CO
Posts: 233
#1: Feb 5 '07
I am not sure if I am in the right place, but maybe someone can help me anyway. I am trying to map a printer by using the IP address in my logon script. I had it set up from the print server //server/printername, but when the print server crashed, we decided not to replace it. Most users, I set up individual, but one computer in paticular has over 45 users. I am not wanting to change each one.
iburyak's Avatar
Expert
 
Join Date: Nov 2006
Posts: 1,017
#2: Feb 5 '07

re: Map printer by IP address in logon script


Try this:

[PHP]Dim goWshNetwork
Dim PrinterPath
Dim PrinterDriver


Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\\10.11.76.21\Epson_1290"
PrinterDriver = "EPSON Stylus Photo 1290"

Set rc = WshNetwork.AddWindowsPrinterConnection(PrinterPath , PrinterDriver)

If Not rc Then
'Error message here
End If[/PHP]
rcollins's Avatar
Familiar Sight
 
Join Date: Aug 2006
Location: Grand Junction, CO
Posts: 233
#3: Feb 5 '07

re: Map printer by IP address in logon script


This gives me an error that the printer name is not valid. I am using the right IP address.
iburyak's Avatar
Expert
 
Join Date: Nov 2006
Posts: 1,017
#4: Feb 5 '07

re: Map printer by IP address in logon script


Try with a server name instead just to make sure this will work.
iburyak's Avatar
Expert
 
Join Date: Nov 2006
Posts: 1,017
#5: Feb 5 '07

re: Map printer by IP address in logon script


Or try similar to this:

[PHP]
Set rc = WshNetwork.AddWindowsPrinterConnection("\\10.11.76 .21\Epson_1290\EPSON Stylus Photo 1290")[/PHP]

I found in one of my applications used this way where everything as one parameter.

Good Luck.
rcollins's Avatar
Familiar Sight
 
Join Date: Aug 2006
Location: Grand Junction, CO
Posts: 233
#6: Feb 5 '07

re: Map printer by IP address in logon script


I still get printer name not valid
iburyak's Avatar
Expert
 
Join Date: Nov 2006
Posts: 1,017
#7: Feb 5 '07

re: Map printer by IP address in logon script


I just used this code to map a printer and it worked.
Make sure printer is on the same network and you have rights to a server.
Try to do the same manually first.

I tried to map with IP address and it worked as well.
See exact code I used:

[PHP]Dim goWshNetwork

Set goWshNetwork = CreateObject("WScript.Network")


goWshNetwork.AddWindowsPrinterConnection "\\10.30.68.78\29-ACSVS"

Set goWshNetwork = Nothing
[/PHP] Good Luck.
rcollins's Avatar
Familiar Sight
 
Join Date: Aug 2006
Location: Grand Junction, CO
Posts: 233
#8: Feb 6 '07

re: Map printer by IP address in logon script


goWshNetwork.AddWindowsPrinterConnection "\\10.30.68.78\29-ACSVS"
Is 29-ACSVS the name of your printer? The one I am using is a hp LaserJet 4250. Is that what I put in place here? Here is what I have, and it still tells me printer name not valid
Expand|Select|Wrap|Line Numbers
  1.  Dim goWshNetwork
  2.  
  3. Set goWshNetwork = CreateObject("WScript.Network")
  4.  
  5.  
  6. goWshNetwork.AddWindowsPrinterConnection "\\192.168.151.20\hp LaserJet 4250"
  7.  
  8.  Set goWshNetwork = Nothing 
  9.  
iburyak's Avatar
Expert
 
Join Date: Nov 2006
Posts: 1,017
#9: Feb 6 '07

re: Map printer by IP address in logon script


Yes, it is a printer name.
Can you map it manually?
Reply