execute a bat file in vbs

Home Forums Scripting Windows Script Host execute a bat file in vbs

This topic contains 0 replies, has 1 voice, and was last updated by Avatar krayzie 8 years, 9 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    krayzie
    Member
    #152068

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

    ‘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:”, “\server1accounts”

    Case “Network Staff”
    objNetwork.MapNetworkDrive “X:”, “\Server2HQ”

    Case “Domain Admins”
    objNetwork.MapNetworkDrive “Y:”, “\DFS_RootShared”

    Case “PSR Users”
    objNetwork.MapNetworkDrive “Z:”, “\DFS_RootIrwindale”
    End Select
    Next
    [/CODE]

    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[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:”, “\server1accounts”

    Case “Network Staff”
    objNetwork.MapNetworkDrive “X:”, “\Server2HQ”

    Case “Domain Admins”
    objNetwork.MapNetworkDrive “Y:”, “\DFS_RootShared”

    Case “PSR Users”
    objNetwork.MapNetworkDrive “Z:”, “\DFS_RootIrwindale”
    End Select
    Next
    [/CODE]

    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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Register for this Petri Webinar!

Software-Defined Unlimited Backup Storage

Tuesday, August 27, 2019 @ 1:00 pm EDT

A Scale-Out Backup storage infrastructure is a must-have technology for your backups. In this webinar, join expert Rick Vanover for a look on what real-world problems are solved by the Scale-Out Backup Repository.

Register Now

Sponsored By