Brian said:
Is there a way of comparing the members of two global
security in an AD environment? The sort of information I
am after is who is a member of Group A and Group B. Is
there something that can be done with VBScript?
You could try this batch file:
@echo off
if "%2"=="" goto Error
pushd %temp%
call :Assemble %1
call :Assemble %2
call :Compare %1 %2
type Common.txt
popd
goto :eof
========================================
:Assemble
if exist %1.* del %1.*
net group %1 | more +6 | find /i /v "successfully" > %1.1
for /F "tokens=1-3" %%a in (%1.1) do (
echo %%a >> %1.2
if not "%%b"=="" echo %%b >> %1.2
if not "%%c"=="" echo %%c >> %1.2
)
goto :eof
========================================
:Compare
echo. > Common.txt
echo Users common to %1 and %2 >> Common.txt
echo ------------------------------ >> Common.txt
for /F %%a in (%1.2) do type %2.2 | find /i "%%a" >>common.txt
goto :eof
========================================
:Error
echo.
echo Usage: Group.bat GroupA GroupB