P
PBartolini
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", , "BiblioPub")
RetVal1 = InputBox("Password", , "Pubblico")
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
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", , "BiblioPub")
RetVal1 = InputBox("Password", , "Pubblico")
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