PC Review


Reply
Thread Tools Rate Thread

AddPrinterConnection

 
 
PBartolini
Guest
Posts: n/a
 
      27th Sep 2004
by,
I have a problem with "AddPrinterConnection"
I have a user that is local (he is not in the NT domain) but he has to
use some CD and printer of the net.
I have made a logon script in VB to connect the local user to the net
using a network userID and password).
when I disconnect/connect the drive it is OK but when I use the script
to dinamically disconnect and reconnect the printe the scipt fail and
I see:
"An Attempt Was Made to Remember a Device That Had Previously Been
Remembered".

I have W2k with SP4
I have find, in the web, that it is a problem resolved by SP4 but I
HAVE SP4!

the script is the following:

Private Sub Form_Load_bak()
On Error GoTo G_Errore
Set objNetwork = CreateObject("WScript.Network")
objNetwork.RemoveNetworkDrive "F:"
objNetwork.RemoveNetworkDrive "I:"
objNetwork.RemoveNetworkDrive "J:"
objNetwork.RemoveNetworkDrive "L:"
objNetwork.RemovePrinterConnection "LPT1:"
'IN THE ABOVE LINES I HAVE NOT ERRORS!

Segue:
RetVal = InputBox("UserID", , "BiblioPubblico")
RetVal1 = InputBox("Password", , "Pubblico1")
RetVal2 = InputBox("Printer", , "\\serv-biblioteca\HPLaserJ")
CONNS = RetVal2

'IN THE FOLLOWING LINE THERE IS THE ERROR!
objNetwork.AddPrinterConnection "LPT1", CONNS, False, RetVal,
RetVal1

'IN THE FOLLOWING LINES I HAVE NOT ERRORS!
CONNS = C_ALICE: objNetwork.MapNetworkDrive "J:", CONNS, False,
UTENTE, PSW
CONNS = C_BNI: objNetwork.MapNetworkDrive "L:", CONNS, False,
UTENTE, PSW
CONNS = C_UOL: objNetwork.MapNetworkDrive "F:", CONNS, False,
UTENTE, PSW
CONNS = C_CLIO: objNetwork.MapNetworkDrive "I:", CONNS, False,
UTENTE, PSW
End
Exit Sub
G_Errore:
If Err.Number = -2147022646 Then Resume Next
Resume Next
End
Exit Sub
End Sub

I have the error only in the "AddPrinterConnection".
the user can be an administrator or a normal user, it's the same.
the domain is a NT domain.
the user system is win 2000 sp4.

Someone can help me?

thanks

Paolo
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AddPrinterConnection failing to add network printer to remote pc veeralp@gmail.com Windows XP Print / Fax 3 16th Nov 2007 11:13 PM
Win32_Printer - AddPrinterConnection - Not Supported on WinXP? =?Utf-8?B?UGFzY2FsIEIu?= Windows XP WMI 3 28th Mar 2005 09:23 PM
AddPrinterConnection() returns error 997 (Overlapped I/O operation is in progress) Afterburn Microsoft VC .NET 4 6th Oct 2004 04:03 PM
AddPrinterConnection PBartolini Microsoft Windows 2000 2 28th Sep 2004 06:46 AM
Re: What is the DllImport for the AddPrinterConnection API? Jonathan Schafer Microsoft C# .NET 2 6th Aug 2003 07:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:03 AM.