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 yeimi 5 years, 10 months ago.
-
AuthorPosts
-
February 4, 2014 at 9:24 am #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
February 4, 2014 at 10:28 am #228409Re: 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
AnonymousFebruary 4, 2014 at 12:46 pm #371648Re: 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.
February 4, 2014 at 12:52 pm #189306Re: 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
-
AuthorPosts
You must be logged in to reply to this topic.