Batch file issue

Home Forums Scripting DOS Command Shell Batch file issue

This topic contains 4 replies, has 5 voices, and was last updated by Avatar yeimi 5 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • Avatar
    glennbtn
    Member
    #163162

    Hi All

    We are having an issue with mapping drives in group policy on windows 7 machines.

    The batch file has a number of drives to map but not all drives will map due to permissions. If the batch file gets to 1 where the users does not have permissions, instead of bypassing that drive it then never seems to complete and any further drives don’t get mapped.

    If I run the file manually it asked for user name for the failed mapping then never goes any further.

    How do I get the script to continue if the user does not have permissions

    eg mapping

    net use H: “\SRV1terms & conditions”
    net use V: “\VISUALFILESsos”
    net use P: “\SRV1probate”
    net use O: “\srv1Legal Forms”

    Any help here would be great, thanks

    Glenn

    Rems
    Rems
    Moderator
    #228409

    Re: Batch file issue

    Mod edit: Moved thread to scripting forums

    When the user does not have permissins to map the drive, they are asked to enter an alternate username and password. That is where your logon batch hangs, waiting for user input.

    If the user is running the batch manually he or she can hit the enter key to continue, leaving the alternate user name field empty.

    In a batch you can program an Enter keystroke as answer like this:

    echo.| net use H: “\SRV1terms & conditions”
    echo.| net.exe use V: “\VISUALFILESsos”
    echo.| net.exe use P: “\SRV1probate”
    echo.| net.exe use O: “\srv1Legal Forms”[/CODE]

    /Rems[CODE]echo.| net use H: “\SRV1terms & conditions”
    echo.| net.exe use V: “\VISUALFILESsos”
    echo.| net.exe use P: “\SRV1probate”
    echo.| net.exe use O: “\srv1Legal Forms”[/CODE]

    /Rems

    Avatar
    Anonymous
    #371648

    Re: Batch file issue

    Another way to resolve the hang is not to encounter it. We map drives for users based on membership in particular groups. If they’re not a member of a group, that drive letter doesn’t get mapped to that user during logon. If the groups are given the permissions on the shares as well, then the only variable is who belongs to the group.

    For each drive map, create a group. Assign that group to the share and set your NTFS permissions. Then create a GPO for the mapped drive letter to the share, and set security filtering to include Domain Admins (just in case) and the group you created earlier. Then add members to the group and have those users log on. They see that drive, no one else does.

    Avatar
    Ossian
    Moderator
    #189306

    Re: Batch file issue

    And since it is Win7, there is a good chance you can use Group Policy Preferences with Client Side Targetting to only map the drive if the user is in the group – no scripts required

    Avatar
    yeimi
    Member
    #387906

    Re: Batch file issue

    hanks All

    I have gone for the echo.| as I don’t understand how I would do groups

    Glenn

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.