Logon Scripts Assigned To User Accounts

J

Jeff

In Windows 2000 Active Directory.....how can I obtain a
list a all user accounts and the name of the logon script
that is associated with there account?
 
J

Jerold Schulman

In Windows 2000 Active Directory.....how can I obtain a
list a all user accounts and the name of the logon script
that is associated with there account?


See tip 6820 in the 'Tips & Tricks' at http://www.jsiinc.com

@echo off
setlocal
if exist "%TEMP%\loscr.tm1" del /q "%TEMP%\loscr.tm1"
if exist "%TEMP%\loscr.tm2" del /q "%TEMP%\loscr.tm2"
set getit=dsquery user domainroot -name * -limit 0
for /f "Tokens=*" %%u in ('%getit%') do set UDN=%%u&call :loscr
if not exist "%TEMP%\loscr.tm1" endlocal&goto :EOF
sort "%TEMP%\loscr.tm1" /O "%TEMP%\loscr.tm2"
type "%TEMP%\loscr.tm2"
del /q "%TEMP%\loscr.tm1"
del /q "%TEMP%\loscr.tm2"
endlocal
goto :EOF
:loscr
for /f "Skip=1 Tokens=1-2" %%i in ('dsget user %UDN% -loscr') do (
if /i "%%i" NEQ "dsget" call :report "%%i"
)
goto :EOF
:report
@echo %UDN% %1>>"%TEMP%\loscr.tm1"


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top