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.
Batch job to utilise two data sources?
Moderator: DosItHelp
Re: Batch job to utilise two data sources?
thanks, that certainly solves part of my problem.
how would/could the script I'm using change to call on both of these items?
how would/could the script I'm using change to call on both of these items?
Re: Batch job to utilise two data sources?
replace
echo(!file1Line! !file2Line!
with
call :yourbat !file1Line! !file2Line!
and use %1 and %2
echo(!file1Line! !file2Line!
with
call :yourbat !file1Line! !file2Line!
and use %1 and %2
Re: Batch job to utilise two data sources?
If for example my on input file has the data already combined as per Liviu's resolution, is there any simple way to modify the original batch script so it uses the two parameters.
some lines of the code.bat contain syntax that requires the two parameters whereas some don't.
icacls x:\homedrives\%1 /grant %2:(OI)(CI)F /T
some lines of the code.bat contain syntax that requires the two parameters whereas some don't.
icacls x:\homedrives\%1 /grant %2:(OI)(CI)F /T