Link to home
Start Free TrialLog in
Avatar of wantabe2
wantabe2Flag for United States of America

asked on

Login Script Drive Mapping Issue

I have the following code in my login script:

If (IsMember(objUser, "Office Users") = True) Then
    On Error Resume Next
    objNetwork.MapNetworkDrive "g:", "\\165.123.32.3\share"
    If (Err.Number <> 0) Then
        On Error GoTo 0
        objNetwork.RemoveNetworkDrive "g:", True, True
        objNetwork.MapNetworkDrive "g:", "\\165.123.32.3\share"
    End If
    On Error GoTo 0
End If

Open in new window


It is supposed to map drive G: but I am prompted for a username & password if I run the script manually. How can I embed the username & password for to access this drive inside the code I have listed above?
ASKER CERTIFIED SOLUTION
Avatar of IanTh
IanTh
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
but cant you add office to \\165.123.32.3\share permissions ?
Avatar of wantabe2

ASKER

So it would look like this? I can't test it at this time but will in about 2 or 3 hours...


If (IsMember(objUser, "Office Users") = True) Then
    On Error Resume Next
    objNetwork.MapNetworkDrive "g:", "\\165.123.32.3\share"
    If (Err.Number <> 0) Then
        On Error GoTo 0
        objNetwork.RemoveNetworkDrive "g:", True, True
        objNetwork.MapNetworkDrive "g:", "\\165.123.32.3\share"
        strUser = theusername
        strPassword = thepassword
    End If
    On Error GoTo 0
End If

Open in new window

yes but I said why does it require the user and password in the script it suggests that the office permissions are not on the share