Announcement

Collapse
No announcement yet.

Simple VBScript Question

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple VBScript Question

    Hi Everyone

    I have just started teaching myself VBscript to help me in a server environment.

    I have written a basic logon script that removes all previous mappings and then maps two network drives. The script is:


    Code:
    on error resume next
    Set clDrives = WshNetwork.EnumNetworkDrives
    For i = 0 to clDrives.Count - 1 Step 2
    WSHNetwork.RemoveNetworkDrive cldrives.Item(i), True, True
    next
    wscript.sleep 300
    Set objNetwork = CreateObject("Wscript.Network")
    objNetwork.MapNetworkDrive "P:", _
    "\\Server\Share1", True
    objNetwork.MapNetworkDrive "T:", _
    "\\Server\Share2", True
    
    MsgBox ("Network Drives Mapped")
    Now my question is, how do i get the message box to display the Name of the Drives mapped? I need it so that i can change the share names according to different groups without having to change the message box text?

    hope that all makes sense and any help for the noob would be much appreciated

    Cheers, Matt

  • #2
    Re: Simple VBScript Question

    Something like:
    (partial code)
    Code:
    strShareName = "\\Server\Share"
    
    objNetwork.MapNetworkDrive "P:", strShareName, True
    
    msgbox("Mapped Drive " & strShareName)
    You will need to change the value of strShareName according to the groups

    Tom
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: Simple VBScript Question

      Cheers mate!

      Comment

      Working...
      X