Last active
September 8, 2015 15:10
-
-
Save Wildcarde/b90e32fb59aafb055cb1 to your computer and use it in GitHub Desktop.
This is a simple batch script I put together for automatically mounting a users shared drive when they log into one of our domain auth'd lab machines. We didn't have direct control over the OU behavior of these machines so we couldn't add a group policy rule, this is an effective workaround for that problem.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
net use * /delete /yes | |
cls | |
set i=0 | |
set group="Domain Users" | |
for /f %%f in ('"gpresult /user %USERNAME% /R | findstr /i %group%"') do set /a i=%i%+1 | |
if %i% gtr 0 (goto :member) | |
:nomember | |
goto :end | |
:member | |
net use z: \\<server fqdn>\<sharename> | |
:end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment