tags:

views:

23

answers:

2

What is happening now, is that .bat files are ran on logon, which executes mapping the drives. We now however want to switch these into a VB script. A couple problems, however:

There are 18 drives to map (f through w)

The users aren't group correctly (if at all). I'm probably going to change them into the correct groups, hopefully three different ones so that the script can look that group up and know what to do.

It has to start up a system called LUMINX (not sure if anyone here has ever worked with it. If you have however, i'm sure you know it's from the darkest and depths of hell). Which is set to a certain IP and under LUMINX_LIVE.

I'm QUITE new to coding, and have never really tackled something like this before. I've looked over some codes that would work, however everyone seems to be a bit off and not have something I need.

Any help would be much appreciated.

+1  A: 

Code to map a drive with vbscript

Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "F:", "\\Server\Folder\Folder"
objNetwork.MapNetworkDrive "G:", "\\Server\Folder2\Folder2"
objNetwork.MapNetworkDrive "H:", "\\Server\Folder3\Folder3"
.......................
objNetwork.MapNetworkDrive "V:", "\\192.x.x.x\luminx_live"

You will need to modify the folder locations but this should work for you. Not sure about the luminx problem (EDIT: included luminx stuff). Is is a service or computer? More details would be helpful

bugtussle
it's a service. Pretty much, it's a benefits enterprise program (what my company does).In the .bat file, it's used as:net use v\\192.x.x.x\luminx_live
AgainstClint
objNetwork.MapNetworkDrive "V:", "\\192.x.x.x\luminx_live"
bugtussle
A: 

You could use the following code to map drives, however this is modified from bugtussle's code as it give the user an error message if the drive cannot be mapped, this may be useful.

Set wshNetwork = CreateObject( "WScript.Network" )
On Error Resume Next

With wshNetwork
    .MapNetworkDrive "G:", "\\CompanyServer\Dept"
    If Err Then
        WScript.Echo "Error " & Err & " mapping drive G:"
        WScript.Echo "(" & Err.Description & ")"
    End If

    .MapNetworkDrive "H:", "\\CompanyServer\" & .UserName
    If Err Then
        WScript.Echo "Error " & Err & " mapping drive H:"
        WScript.Echo "(" & Err.Description & ")"
    End If
End With

On Error Goto 0
Set wshNetwork = Nothing
Connnnoorr