execute a bat file in vbs

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

Viewing 1 post (of 1 total)
  • Author
    Posts

  • 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.

External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by: