Find logon scripts in AD user properties through AD PowerShell:
PS> Get-ADUser -filter * -properties scriptpath, homedrive, homedirectory | ft Name, scriptpath, homedrive, homedirectory
Also check GPO.
Change your .bat script to .vbs and made changes inside by fllowing:
Option Explicit
Dim strDriveLetter
Dim objShell, objNetwork
Dim CheckDrive, AlreadyConnected, intDrive
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set CheckDrive = objNetwork.EnumNetworkDrives()
REM --- Connect Drive W: \\SERVER\WORKSPACE ---
strDriveLetter = "W:"
On Error Resume Next
AlreadyConnected = False
For intDrive = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(intDrive) =strDriveLetter Then AlreadyConnected =True
Next
If AlreadyConnected = True then
REM objShell.PopUp "Drive " & strDriveLetter & _ " is already connected"
Set objNetwork = CreateObject("Wscript.Network") objNetwork.RemoveNetworkDrive "W:", True, True
objNetwork.MapNetworkDrive "W:", "\\CSNAS\WORKSPACE", True
Else
REM objShell.PopUp "Drive " & strDriveLetter & _ " is not connected."
Set objNetwork = CreateObject("Wscript.Network") objNetwork.RemoveNetworkDrive "W:", True, True
objNetwork.MapNetworkDrive "W:", "\\CSNAS\WORKSPACE", True
End if
REM --- Connect Drive W: \\SERVER\UTILS ---
strDriveLetter = "K:"
On Error Resume
Next AlreadyConnected = False
For intDrive = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(intDrive) =strDriveLetter Then AlreadyConnected =True
Next
If AlreadyConnected = True then
REM objShell.PopUp "Drive " & strDriveLetter & _ " is already connected"
Set objNetwork = CreateObject("Wscript.Network") objNetwork.RemoveNetworkDrive "K:", True, True
objNetwork.MapNetworkDrive "K:", "\\CSNAS\UTILS", True
Else
REM objShell.PopUp "Drive " & strDriveLetter & _ " is not connected."
Set objNetwork = CreateObject("Wscript.Network") objNetwork.RemoveNetworkDrive "K:", True, True
objNetwork.MapNetworkDrive "K:", "\\CSNAS\UTILS", True
End if
WScript.Quit