Windows 7 and Network Drive Mappings

Status
Not open for further replies.

Osiris

Golden Master
Messages
36,817
Location
Kentucky
I finally figured out how to map network drives in Windows 7.

Code:
@echo off
Echo ArvinMeritor Logon Script
VER | find "NT" > nul 
   IF not errorlevel 1 GOTO Win_NT 
VER | find "2000" > nul 
   IF not errorlevel 1 GOTO Win_NT 
VER | find "XP" > nul 
   IF not errorlevel 1 GOTO Win_NT 
VER | find "98" > nul 
   IF not errorlevel 1 GOTO Win_9X 
VER | find "95" > nul 
   IF not errorlevel 1 GOTO Win_9X 
VER | find "5.2.3790" > nul 
   IF not errorlevel 1 GOTO Win_NT
VER | find "6.1" > nul
   IF not errorlevel 1 GOTO Win_7
GOTO unknown_os 
:win_NT 
   IF EXIST %WINDIR%\KIX32.EXE CALL %WINDIR%\KIX32.EXE %logonserver%\netlogon\KIXTART.KIX && GOTO END
   IF NOT EXIST %WINDIR%\KIX32.EXE COPY %logonserver%\netlogon\KIX\K*.* %windir%\
   CALL %WINDIR%\KIX32.EXE %logonserver%\netlogon\KIXTART.KIX
GOTO END
:win_7
   IF Exist [URL="file://\\servername\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs"]\\servername\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs[/URL] START [URL="file://\\servername\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs"]\\servername\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs[/URL]
GOTO END
:win_9X 
   IF EXIST %WINDIR%\KIX32.EXE CALL %WINDIR%\KIX32.EXE %0\..\KIXTART.KIX
   IF NOT EXIST %WINDIR%\KIX32.EXE CALL %0\..\KIX\KIX32.EXE %0\..\KIXTART.KIX
 
:unknown_os 
:end

I added the Windows version

Code:
VER | find "6.1" > nul
   IF not errorlevel 1 GOTO Win_7

and the VB Script

Code:
:win_7
   IF Exist [URL="file://\\servername6\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs"]\\servername6\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs[/URL] START [URL="file://\\servername\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs"]\\servername\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs[/URL]
GOTO END

Here is the VB Script

On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "R:", "\\Servername\DShares"
On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "N:", "\\Servername\DShares\SAP"
On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "S:", "\\Servername\GShares"
On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "Q:", "\\Servername\QS9000"
On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "X:", "\\Servername\Network_Scanning"
On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "G:", "\\Servername\apps"


On Error Resume Next
Dim strDriveLetter, strRemotePath, strUserName
strDriveLetter = "H:"
strRemotePath = "
 
Status
Not open for further replies.
Back
Top Bottom