I will make the batch file display as it processes; and report back or if I figure it out I will report what I did.
the name of the file is mgr.txt, and no, it does not have spaces. Actually this part of the code works:
for /f %%i in (mgr.txt) do (dsquery user -samid %%i | dsget user -memberof | findstr /C:"Syncplicity"
so, that part of the code is solid and proven.
note: when I run this is the command line I remove the second % symbol.
note: when run as above I add the >>file.txt line, but of course all I get is the name of the distinguished name of the group, which is useless.
What I'm trying to do is compare the usernames contained in mgr.txt to the names in the Syncplicity AD group. I would like for the routine to take the name from the text file and see if Syncplicity is one of the groups the users belongs to. if the user belongs to the group I'd like for the routine to display "xyxyxy" is a member, alternatively to display "xyxyxy" is NOT a member.
the original batch file would do this for one user, I ran the batch file like this "syncme xyxyxy". the batch file would run and return with the message desired. I tested the results of the file extensively and the results were trustworthy. So, the original file looks like this:
@echo off
dsquery user -samid %1 | dsget user -memberof | findstr /c:"Syncplicity" > nul
if %errorlevel% == 0 (
echo %1 is a member
) ELSE (
echo %1 is NOT a member
)