Windows login script question

coolred

Diamond Member
Nov 12, 2001
4,911
0
0
I have to do some login scripts for one of my classes, and I managed to miss the class were we went over that info. I have done 1 for a class I had last quarter, but don't fully remember it. I just need it to map some drives. I think I understand how to do that

net use drive letter: \\computer name\share name, right?

But I am wondering if there is any other commands I need, to make the script work that maybe I am forgetting
 

Kappo

Platinum Member
Aug 18, 2000
2,381
0
0
If you are using .bat files, then that will take care of it. Ive started porting everything over to vbscript now, but bat files are REALLY easy.

If you want more options (ie- to map it by a specific username) you can just do net use /? to get the full usage.
 

nanaki333

Diamond Member
Sep 14, 2002
3,772
13
81
you doing login scripts for a domain in group policy?
if so, you'll need to save this as a .vbs and set it as the logon script:

Option Explicit
Dim strDriveLetter1, strRemotePath1
Dim strDriveLetter2, strRemotePath2
Dim objNetwork, objShell
Dim CheckDrive, AlreadyConnected, intDrive
' This sections creates two objects:
' objShell and objNetwork and counts the drives
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set CheckDrive = objNetwork.EnumNetworkDrives()
' The section sets the variables.
strDriveLetter1 = "Y:"
strDriveLetter2 = "Z:"
strRemotePath1 = "\\SERVER\FOLDER\" & objNetwork.UserName
strRemotePath2 = "\\SERVER\FOLDER"
' This section deals with a For ... Next loop
' See how it compares the enumerated drive letters
' with strDriveLetter
On Error Resume Next
AlreadyConnected = False
For intDrive = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(intDrive) =strDriveLetter1 _
Then AlreadyConnected =True
Next
' This section uses the If = then, else logic
' This tests to see if the Drive is already mapped.
' If yes then disconnects
If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive strDriveLetter1
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
' The first message box
objShell.PopUp "Drive " & strDriveLetter1 & _
"Disconnected, then connected successfully."
Else
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objShell.PopUp "Drive " & strDriveLetter1 & _
" connected successfully." End if
' This section deals with a For ... Next loop
' See how it compares the enumerated drive letters
' with strDriveLetter
On Error Resume Next
AlreadyConnected = False
For intDrive = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(intDrive) =strDriveLetter2 _
Then AlreadyConnected =True
Next
' This section uses the If = then, else logic
' This tests to see if the Drive is already mapped.
' If yes then disconnects
If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive strDriveLetter2
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
' The first message box
objShell.PopUp "Drive " & strDriveLetter2 & _
"Disconnected, then connected successfully."
Else
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
objShell.PopUp "Drive " & strDriveLetter2 & _
" connected successfully." End if
WScript.Quit