Hello all, thank you for your time.
We are going to transfer our logon/logoff scripts from batch files to vbscript files. I have written a simple logon script for one of the departments that looks like this.
'===================
'cpsupport.vbs
'12/04/2007
'author: caley woods
'===================
Option Explicit
'==============================
'Declaring variables to be used
'==============================
Dim objNetwork, strDriveLetter1, strDriveLetter2, strDriveLetter3, strDriveLetter4, strProfile
Dim strRemotePath1, strRemotePath2, strRemotePath3, strRemotePath4, strUserName, strPassword
Set objNetwork = CreateObject("WScript.Network")
'========================================
'Defining the Drive Letters and UNC Paths
'========================================
strDriveLetter1 = "R:" 'Must be Capital
'strDriveLetter2 = "Y:"
'strDriveLetter3 = "T:"
'strDriveLetter4 = "W:"
strRemotePath1 = "\\server.domain.int\computersup" 'UNC name
'strRemotePath2 = "\\server.domain.int\v000"
'strRemotePath3 = "\\server2.domain.int\v214"
'strRemotePath4 = "\\server2.domain.int\V095"
strUserName = "user"
strPassword = "password"
strProfile = "False"
'======================================
'Mapping the UNC Path to a Drive Letter
'======================================
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1, strProfile, strUserName, strPassword
'objWSHNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2, strProfile, strUserName, strPassword
'objWSHNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3, strProfile, strUserName, strPassword
'objWSHNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4, strProfile, strUserName, strPassword
Wscript.Echo "Successfully Mapped Drives"
Wscript.Echo "Cleaning variables out of memory"
'======================================================
'Below cleans up used memory from the Dim command above
'======================================================
set objNetwork = nothing
set strDriveLetter1 = nothing
set strDriveLetter2 = nothing
set strDriveLetter3 = nothing
set strDriveLetter4 = nothing
set strRemotePath1 = nothing
set strRemotePath2 = nothing
set strRemotePath3 = nothing
set strRemotePath4 = nothing
set strUserName = nothing
set strPassword = nothing
Wscript.Quit
The script isnt final, in the final version the Wscript.Echo messages will be removed so the script is silent. You will notice a bunch of things commented out, this is currently for troubleshooting purposes. And all of the variables or strings that appear on another line really are not.
My question is, I receive "The specified network password is not correct." when I run the script. I am baffled by what is causing this, my only guess is that it has something to do with how the script is supplying the username and password to the server and not a bad password in my script. I can successfully open a command line and do 'net use R: \\server.domain.int\share' and then type in the username and password just as I have it in my script and it works no problem, what am I missing? Thank you again, sorry for the long post.
We are going to transfer our logon/logoff scripts from batch files to vbscript files. I have written a simple logon script for one of the departments that looks like this.
'===================
'cpsupport.vbs
'12/04/2007
'author: caley woods
'===================
Option Explicit
'==============================
'Declaring variables to be used
'==============================
Dim objNetwork, strDriveLetter1, strDriveLetter2, strDriveLetter3, strDriveLetter4, strProfile
Dim strRemotePath1, strRemotePath2, strRemotePath3, strRemotePath4, strUserName, strPassword
Set objNetwork = CreateObject("WScript.Network")
'========================================
'Defining the Drive Letters and UNC Paths
'========================================
strDriveLetter1 = "R:" 'Must be Capital
'strDriveLetter2 = "Y:"
'strDriveLetter3 = "T:"
'strDriveLetter4 = "W:"
strRemotePath1 = "\\server.domain.int\computersup" 'UNC name
'strRemotePath2 = "\\server.domain.int\v000"
'strRemotePath3 = "\\server2.domain.int\v214"
'strRemotePath4 = "\\server2.domain.int\V095"
strUserName = "user"
strPassword = "password"
strProfile = "False"
'======================================
'Mapping the UNC Path to a Drive Letter
'======================================
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1, strProfile, strUserName, strPassword
'objWSHNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2, strProfile, strUserName, strPassword
'objWSHNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3, strProfile, strUserName, strPassword
'objWSHNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4, strProfile, strUserName, strPassword
Wscript.Echo "Successfully Mapped Drives"
Wscript.Echo "Cleaning variables out of memory"
'======================================================
'Below cleans up used memory from the Dim command above
'======================================================
set objNetwork = nothing
set strDriveLetter1 = nothing
set strDriveLetter2 = nothing
set strDriveLetter3 = nothing
set strDriveLetter4 = nothing
set strRemotePath1 = nothing
set strRemotePath2 = nothing
set strRemotePath3 = nothing
set strRemotePath4 = nothing
set strUserName = nothing
set strPassword = nothing
Wscript.Quit
The script isnt final, in the final version the Wscript.Echo messages will be removed so the script is silent. You will notice a bunch of things commented out, this is currently for troubleshooting purposes. And all of the variables or strings that appear on another line really are not.
My question is, I receive "The specified network password is not correct." when I run the script. I am baffled by what is causing this, my only guess is that it has something to do with how the script is supplying the username and password to the server and not a bad password in my script. I can successfully open a command line and do 'net use R: \\server.domain.int\share' and then type in the username and password just as I have it in my script and it works no problem, what am I missing? Thank you again, sorry for the long post.