Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Please Help: Adding Printer with Authentication

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1263
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Please Help: Adding Printer with Authentication
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Please Help: Adding Printer with Authentication - 8/17/2004 11:40:46 PM   
  avivgur

 

Posts: 5
Score: 0
Joined: 8/17/2004
From:
Status: offline
Hello,
I am trying to add a network printer via a vbscript but the printer server requires authentication. If I just run:
wshnetwork.addwindowsprinterconnection "\\samba\hpintel"
I get the "Permission Denied" error message.

For some reason the addwindowsprinterconnection function doesn't accept any username\password arguments while the addprinterconnection function (not windows) does accept such arguments.
I also tryed using the addprinterconnection function as in:
wshnetwork.addprinterconnection "LPT1", "\\samba\hpintel", true, "cs\avivgur", strPassword
The script completes without errors but no printer is added to the "Printers and Faxes" window.

Is there any way to apply a username and password for authentication with the printer server and to have the printer appear in the "Printers and Faxes" window?

Thanks in advance,
Aviv
 
 
Post #: 1
 
 Re: Please Help: Adding Printer with Authentication - 8/18/2004 12:31:59 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Try to map a drive to the server that has the printer on it, then add the printer.

(in reply to avivgur)
 
 
Post #: 2
 
 Re: Please Help: Adding Printer with Authentication - 8/18/2004 1:05:12 AM   
  avivgur

 

Posts: 5
Score: 0
Joined: 8/17/2004
From:
Status: offline
No such luck...
Still "Permission Denied"
Any more ideas?
Thanks,
Aviv

(in reply to avivgur)
 
 
Post #: 3
 
 Re: Please Help: Adding Printer with Authentication - 8/18/2004 2:00:18 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
I ran into the same problem when I tested mapping to the print server before adding the printer. But I just tried this and it worked. Use Net use the syntax in question is
NET USE <devicename | *> [password | *] /HOME

WshShell.Run "cmd /k net use \\Server\PrinterName /USER:DOMAIN\USERNAME PASSWORD",1,true
WshNetwork.AddWindowsPrinterConnection "\\Server\PrinterName"


Mike

(in reply to avivgur)
 
 
Post #: 4
 
 Re: Please Help: Adding Printer with Authentication - 8/18/2004 7:48:06 PM   
  avivgur

 

Posts: 5
Score: 0
Joined: 8/17/2004
From:
Status: offline
Nope...
I get "the command completed successfuly" for the 'net use'.
And after I close the generated dos window I get the good old "Permission Denied" error.
Help...
Thanks,
Aviv.

(in reply to avivgur)
 
 
Post #: 5
 
 Re: Please Help: Adding Printer with Authentication - 8/19/2004 1:44:15 AM   
  avivgur

 

Posts: 5
Score: 0
Joined: 8/17/2004
From:
Status: offline
I just had an insight on the problem...
I tried to map a printer that was on a different server (not \\samba)
and with the proper mapped network drives I was able to add the printer.
Therefore, I conclude that the original problem might have to do with the fact that the printer serevr is SAMBA and with how samba authenticates...
Does anyone know anything about this?
Thanks,
Aviv.

(in reply to avivgur)
 
 
Post #: 6
 
 Re: Please Help: Adding Printer with Authentication - 8/20/2004 12:15:50 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Unfortunately I can't help you here, not familiar with Samba.

(in reply to avivgur)
 
 
Post #: 7
 
 RE: Re: Please Help: Adding Printer with Authentication - 12/3/2005 3:07:55 AM   
  steveodevo

 

Posts: 1
Score: 0
Joined: 12/3/2005
Status: offline
I have a similar problem...

Our print server (WinNT in a workgroup environment) stores all users with blank passwords to ease deployment (not practical to expect everyone to type their passowrds into the server all the time).

I thought I got around the problem by mapping a drive using "\\server\share", false,  "strUserName", "" (no password) then using addWindowsPrinterConnection NB the username is a variable (strUserName = oNetwork.UserName).

This works great if the "Printers and Faxes" window is open when the script runs (eg during testing).  However, if the Printers and Faxes windows is closed (eg during logon script execution) the printer share is added, but actual connection to the printer will be made using the local user account details (with a password) and will fail authentication.  I've tested this theory by adding a password to the print server user account while being denied access - the share immediately starts working.

Another strange thing about this is if I hard code in a username, the script works flawlessly every time - even with the Printers and Faxes window closed.  Unfortunately we need the actual user's name for our print logs.

Steve.

(in reply to mbouchard)
 
 
Post #: 8
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Please Help: Adding Printer with Authentication Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts