473,325 Members | 2,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Map printer by IP address in logon script

rcollins
234 100+
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.
Feb 5 '07 #1
8 9066
iburyak
1,017 Expert 512MB
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]
Feb 5 '07 #2
rcollins
234 100+
This gives me an error that the printer name is not valid. I am using the right IP address.
Feb 5 '07 #3
iburyak
1,017 Expert 512MB
Try with a server name instead just to make sure this will work.
Feb 5 '07 #4
iburyak
1,017 Expert 512MB
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.
Feb 5 '07 #5
rcollins
234 100+
I still get printer name not valid
Feb 5 '07 #6
iburyak
1,017 Expert 512MB
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.
Feb 5 '07 #7
rcollins
234 100+
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.  
Feb 6 '07 #8
iburyak
1,017 Expert 512MB
Yes, it is a printer name.
Can you map it manually?
Feb 6 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: CH3 | last post by:
Hi, I've not done any programming for years, but I would like to write a simple program/script to help with something at work. We have several print servers for our 2000+ users, and whenever we...
1
by: cwnewbe1 | last post by:
I would like to be able to add environment symbols to the Microsoft XP registry. I tried the example in the Python Cookbook by Orielly by running the script locally and it worked fine. Although I...
6
by: Salty Dog | last post by:
Code: <%Response.Buffer = False%> <HTML> <HEAD> <title>Printing</title> </HEAD> <BODY> <center> <% FilePath = "c:\WUTemp\441817810_receiver.txt"
4
by: Paul H | last post by:
OK, I tried getting and old Newbury Data ND2500 working using the "Generic /Text only" driver in Win XP. It prints, but I could not find a way to set a custom page size that matches the paper I am...
3
by: Alex | last post by:
Hi everyone, We're trying to write a script that will monitor 6 email addresses and if an email arrives it will print to a specific network printer based on the email address. So if the address...
2
by: Terry Olsen | last post by:
Can anyone give me some guidance on installing a local printer with VB 2005? I'm guessing I would probably do this with WMI, but i'm not finding anything obvious. I see how to add a networked...
8
by: msnews.microsoft.com | last post by:
Our IT team relocated our application servers yesterday. They had to take one machine out of the cluster because it would prompt users for credentials if accessed using the IP address, which I...
6
by: Ian | last post by:
I am trying to get MS Access 2000 to print names and addresses onto a Dymo 400 label printer, I have set the Access Report to automatically select the correct printer, then select the label size of...
1
by: RAVEN88 | last post by:
I would like to use a "batch" script to permanently add a server-connected printer to a local computer. This script will have to contain a username and password as you need to logon to the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.