?
Solved

AD or LDAP query needed.....

Posted on 2004-08-31
3
Medium Priority
?
255 Views
Last Modified: 2010-04-13
I'd like to query Active Directory and I believe I would have to use an LDAP query for this one.

I'd like to return a list of usernames with the logon script defined in their profile.
I can't seem to find anything regarding the logon script in the advanced filter in AD U/C.

Any help is greatly appreciated.

Matthewe Jones
matthewjones@comcast.net
0
Comment
Question by:matthewjones
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Expert Comment

by:BigC666
ID: 11944722
howdy,

have a look at this  http://www.microsoft.com/technet/scriptcenter/solutions/spnquery.mspx

hope that it helps
0
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 total points
ID: 11945413
That should give you a list of your users and the according logon scripts. If you have the W2k Resource Kit (in particular global.exe), this could be simplified a bit; most of the script handles the unbearable "net user" output ...

====8<----[LogonScripts.cmd]----
@echo off
setlocal
set TempFile=%~dpn0.tmp

if exist "%TempFile%" del "%TempFile%"
:: *** The number of the first useless lines of the 'net group "domain users" /domain' command output:
set NetFirst=4
:: *** The last line of the 'net user /domain' command output:
set NetLast=The command completed successfully

for /f "skip=%NetFirst% delims=" %%a in ('net user /domain') do (
 set Line=%%a
 call :UserList
)
for /f %%a in ('type "%TempFile%"') do (
  for /f "tokens=2*" %%i in ('net user %%a /domain ^| find /i "Logon script"') do echo %%a,%%j
)
goto leave

:UserList
:: *** Get the accounts, configured in three columns:
set Account1=%Line:~0,25%
set Account2=%Line:~25,25%
set Account3=%Line:~50,25%
:: *** Avoid processing the "The command completed successfully" line
if /i "%Account1%"=="%NetLast:~0,25%" goto :eof
:: *** Remove spaces
if not "%Account1%"=="" set Account1=%Account1: =%
if not "%Account2%"=="" set Account2=%Account2: =%
if not "%Account3%"=="" set Account3=%Account3: =%
if "%Account1%"=="" goto :eof
>>"%TempFile%" echo %Account1%
if "%Account2%"=="" goto :eof
>>"%TempFile%" echo %Account2%
if "%Account3%"=="" goto :eof
>>"%TempFile%" echo %Account3%
goto :eof

:leave
del "%TempFile%"
====8<----[LogonScripts.cmd]----
0
 
LVL 1

Author Comment

by:matthewjones
ID: 11945813
oBdA gave a quick and right on answer + a script I can learn from.

Thank you both for the fast answer and knoweldge..

Matthew Jones
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question