Batch job to utilise two data sources?
Posted: 05 Aug 2012 15:05
Hello,
I'm working on a script that resets user permissions to their homedrive folder based on an export (of SAM id's) from another batch script.
The batch job consists of two files:
go.bat which executes the job
for /f %%i in (users.txt) do @cmd-series %%i
contents of user.txt is:
username1
username2
username3
.
.
which calls cmd-series.bat
icacls d:\homedrives\%1 /grant %1:(OI)(CI)F /T
In a perfect world this works perfectly but some users have homedrives using names that do not match the SAM id so the script is not always successful.
I do have a second file which contains an export of the homedrive locations (same amount of entries contained) which would marry up with the SAM id file list if there were placed side by side. For example, the contents of these file could be:
fred
bob
alan
.
.
Q. Is there anyway to adapt this batch script so it can take both these exports of user homedrive and SAM data and apply the attribute settings i'm after as part of this job?
Feedback greatly appreciated.
I'm working on a script that resets user permissions to their homedrive folder based on an export (of SAM id's) from another batch script.
The batch job consists of two files:
go.bat which executes the job
for /f %%i in (users.txt) do @cmd-series %%i
contents of user.txt is:
username1
username2
username3
.
.
which calls cmd-series.bat
icacls d:\homedrives\%1 /grant %1:(OI)(CI)F /T
In a perfect world this works perfectly but some users have homedrives using names that do not match the SAM id so the script is not always successful.
I do have a second file which contains an export of the homedrive locations (same amount of entries contained) which would marry up with the SAM id file list if there were placed side by side. For example, the contents of these file could be:
fred
bob
alan
.
.
Q. Is there anyway to adapt this batch script so it can take both these exports of user homedrive and SAM data and apply the attribute settings i'm after as part of this job?
Feedback greatly appreciated.