+ Post New Thread
Results 1 to 5 of 5
Scripts Thread, VB Script to check if someone is member of a group then map a drive if they are? in Coding and Web Development; Is there an easy way to do this at all?!?! Want to create a new single logon script instead of ...
  1. #1
    Sam_Brown's Avatar
    Join Date
    Sep 2009
    Location
    Northampton
    Posts
    564
    Thank Post
    94
    Thanked 37 Times in 35 Posts
    Rep Power
    18

    VB Script to check if someone is member of a group then map a drive if they are?

    Is there an easy way to do this at all?!?!

    Want to create a new single logon script instead of using the 20 we have at the moment. Want to map drives depending on what groups they are members of.

    Is there an easy way to do this?!?!

    Hope you can help!

  2. #2

    Join Date
    Dec 2007
    Posts
    867
    Thank Post
    90
    Thanked 165 Times in 140 Posts
    Rep Power
    49
    A GUI based alternative is Group Policy Preferences (GPP) that can do this for you...

    Works with Server 2003 upwards...
    Windows XP with update patch, or Windows 7 upwards...

    Just need a Windows 7 Client to configure the GPP within your Group Policies.

  3. #3

    Join Date
    May 2013
    Posts
    3
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    pretty universal login script here...
    Code:
    ' Get current username
    strUser = ""
    Do While strUser = ""
        strUser = objNetwork.UserName
        WScript.Sleep 100
    Loop
    
    
    set objUser = GetObject("WinNT://CORPORATE/" & strUser &",User")
    
    
    ' Enumerate Group Membership
    strGroups = ";"
    For Each objGroup In objUser.Groups
       strGroups = strGroups & objGroup.Name & ";"
    Next
    
    
    ' the command
    MapGroup "Training", "T:", "\\SAN\Group$\Training"
    
    
    ' Uses the MapDrive function to map a network drive for a particular user group.
    '
    Sub MapGroup(strGPName, strDrive, strShare)
       Const vbTextCompare = 1
       If InStr(1, strGroups, strGPName, vbTextCompare) > 0 Then
       MapDrive strDrive, strShare
       End If
    End Sub
    Last edited by bytejunkie; 7th May 2013 at 11:40 AM.

  4. #4

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,680
    Thank Post
    516
    Thanked 2,451 Times in 1,897 Posts
    Blog Entries
    24
    Rep Power
    832
    This is the script I created a little while ago - Simple drive mapping and printer deployment - Script Center - Spiceworks

  5. #5
    Marshall_IT's Avatar
    Join Date
    Jul 2011
    Location
    Leeds
    Posts
    473
    Thank Post
    73
    Thanked 57 Times in 48 Posts
    Blog Entries
    1
    Rep Power
    17
    We use Group Policy to Map drives based on Group membership.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 7
    Last Post: 16th December 2011, 05:54 AM
  2. script to check virtual machine is running
    By RabbieBurns in forum Scripts
    Replies: 4
    Last Post: 21st January 2010, 10:49 PM
  3. Script to check if webpage/Eportal is working?
    By burgemaster in forum Scripts
    Replies: 8
    Last Post: 12th June 2009, 02:06 PM
  4. Script to check if app is running ...
    By pooley in forum Windows
    Replies: 4
    Last Post: 5th January 2009, 11:31 AM
  5. Replies: 4
    Last Post: 25th December 2006, 09:15 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •