Announcement

Collapse
No announcement yet.

execute a bat file in vbs

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

  • execute a bat file in vbs

    hey guys im just trying to put together a login script with this basic one i found

    Code:
    'VBS script, Map Drives Based on Group Membership
    
    On Error Resume Next
    
    Set objSysInfo = CreateObject("ADSystemInfo")
    Set objNetwork = CreateObject("Wscript.Network")
    
    strUserPath = "LDAP://" & objSysInfo.UserName
    Set objUser = GetObject(strUserPath)
    
    For Each strGroup in objUser.MemberOf
        strGroupPath = "LDAP://" & strGroup
        Set objGroup = GetObject(strGroupPath)
        strGroupName = objGroup.CN
    
     Select Case strGroupName
       Case "Accounts"
         objNetwork.MapNetworkDrive "V:", "\\server1\accounts"
               
       Case "Network Staff" 
         objNetwork.MapNetworkDrive "X:", "\\Server2\HQ"
    
       Case "Domain Admins"
         objNetwork.MapNetworkDrive "Y:", "\\DFS_Root\Shared"
    
       Case "PSR Users"
        objNetwork.MapNetworkDrive "Z:", "\\DFS_Root\Irwindale"
        End Select
    Next

    my question is what would be the best way to add in a command for a group to execute a bat file or would it be better to do it via GPO

    thanks
Working...
X