Members of security groups & user ID"s to name
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Members of security groups & user ID"s to name

 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming
Author Message
lee
Guest





Posted: Tue Jan 04, 2005 2:35 am    Post subject: Members of security groups & user ID"s to name Reply with quote

Cleaning up a new (to me) environment. I'm looking for a way to enumerate the
members of the Local Administrators group and then list the members of any
security groups in the Admin group by user name.
I've got a script to list the members but can't get the security
group listing (Like sql_dba members) and their names.

Thanks for any help you can provide.
Back to top
Jerold Schulman
Guest





Posted: Wed Jan 05, 2005 1:10 am    Post subject: Re: Members of security groups & user ID"s to name Reply with quote

On Mon, 3 Jan 2005 12:35:05 -0800, lee <lee@discussions.microsoft.com> wrote:

Quote:
Cleaning up a new (to me) environment. I'm looking for a way to enumerate the
members of the Local Administrators group and then list the members of any
security groups in the Admin group by user name.
I've got a script to list the members but can't get the security
group listing (Like sql_dba members) and their names.

Thanks for any help you can provide.


See the script at tip 8875 in the 'Tips & Tricks' at http://www.jsiinc.com
(http://www.jsiinc.com/SUBR/tip8800/rh8875.htm)


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
Back to top
lee
Guest





Posted: Wed Jan 05, 2005 2:17 am    Post subject: Re: Members of security groups & user ID"s to name Reply with quote

That gets me all the users, thanks. What do I need to add to take the lan
ID's to an actual user name? And run against a list of servers from one
central server?

Lee

"Jerold Schulman" wrote:

Quote:
On Mon, 3 Jan 2005 12:35:05 -0800, lee <lee@discussions.microsoft.com> wrote:

Cleaning up a new (to me) environment. I'm looking for a way to enumerate the
members of the Local Administrators group and then list the members of any
security groups in the Admin group by user name.
I've got a script to list the members but can't get the security
group listing (Like sql_dba members) and their names.

Thanks for any help you can provide.


See the script at tip 8875 in the 'Tips & Tricks' at http://www.jsiinc.com
(http://www.jsiinc.com/SUBR/tip8800/rh8875.htm)


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
Back to top
Jerold Schulman
Guest





Posted: Wed Jan 05, 2005 2:53 am    Post subject: Re: Re: Members of security groups & user ID"s to name Reply with quote

It displays the User ID (sAMAccountName) when I run it.
Did you mean the distinguishedName?

To run it on remote servers or workstations, use PsExec, tip 4141 in the 'Tips & Tricks' at http://www.jsiinc.com


On Tue, 4 Jan 2005 12:17:03 -0800, lee <lee@discussions.microsoft.com> wrote:

Quote:
That gets me all the users, thanks. What do I need to add to take the lan
ID's to an actual user name? And run against a list of servers from one
central server?

Lee

"Jerold Schulman" wrote:

On Mon, 3 Jan 2005 12:35:05 -0800, lee <lee@discussions.microsoft.com> wrote:

Cleaning up a new (to me) environment. I'm looking for a way to enumerate the
members of the Local Administrators group and then list the members of any
security groups in the Admin group by user name.
I've got a script to list the members but can't get the security
group listing (Like sql_dba members) and their names.

Thanks for any help you can provide.


See the script at tip 8875 in the 'Tips & Tricks' at http://www.jsiinc.com
(http://www.jsiinc.com/SUBR/tip8800/rh8875.htm)


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



Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
Back to top
lee
Guest





Posted: Wed Jan 05, 2005 3:37 am    Post subject: Re: Re: Members of security groups & user ID"s to name Reply with quote

I apologize for not being clear Jerold. What I am hoping to get is the
'Display Name' value from the General tab of the User's property page. I
don't know if we can isolate that value or not.
Thanks for helping.

"Jerold Schulman" wrote:

Quote:

It displays the User ID (sAMAccountName) when I run it.
Did you mean the distinguishedName?

To run it on remote servers or workstations, use PsExec, tip 4141 in the 'Tips & Tricks' at http://www.jsiinc.com


On Tue, 4 Jan 2005 12:17:03 -0800, lee <lee@discussions.microsoft.com> wrote:

That gets me all the users, thanks. What do I need to add to take the lan
ID's to an actual user name? And run against a list of servers from one
central server?

Lee

"Jerold Schulman" wrote:

On Mon, 3 Jan 2005 12:35:05 -0800, lee <lee@discussions.microsoft.com> wrote:

Cleaning up a new (to me) environment. I'm looking for a way to enumerate the
members of the Local Administrators group and then list the members of any
security groups in the Admin group by user name.
I've got a script to list the members but can't get the security
group listing (Like sql_dba members) and their names.

Thanks for any help you can provide.


See the script at tip 8875 in the 'Tips & Tricks' at http://www.jsiinc.com
(http://www.jsiinc.com/SUBR/tip8800/rh8875.htm)


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



Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
Back to top
Jerold Schulman
Guest





Posted: Wed Jan 05, 2005 1:09 pm    Post subject: Re: Re: Re: Members of security groups & user ID"s to name Reply with quote

You can modify the script to display the displayName instead of the sAMAccountName for domain users, but not for local users.

It might be easier to run the following script:

@echo off
setlocal
for /f "Tokens=1* Delims=\" %%a in ('administrators.bat') do (
call :user "%%a" "%%b"
)
endlocal
goto :EOF
:user
set disp=NONE
set u1=%1
set u2=%2
set u1=%u1:"=%
set u2=%u2:"=%
set qry=dsquery * domainroot -filter "(&(objectCategory=Person)(sAMAccountName=%2))" -attr displayName -L
for /f "Tokens=*" %%u in ('%qry%') do (
set disp=%%u
)
@echo %u1%\%u2% %disp%



On Tue, 4 Jan 2005 13:37:08 -0800, lee <lee@discussions.microsoft.com> wrote:

Quote:
I apologize for not being clear Jerold. What I am hoping to get is the
'Display Name' value from the General tab of the User's property page. I
don't know if we can isolate that value or not.
Thanks for helping.

"Jerold Schulman" wrote:


It displays the User ID (sAMAccountName) when I run it.
Did you mean the distinguishedName?

To run it on remote servers or workstations, use PsExec, tip 4141 in the 'Tips & Tricks' at http://www.jsiinc.com


On Tue, 4 Jan 2005 12:17:03 -0800, lee <lee@discussions.microsoft.com> wrote:

That gets me all the users, thanks. What do I need to add to take the lan
ID's to an actual user name? And run against a list of servers from one
central server?

Lee

"Jerold Schulman" wrote:

On Mon, 3 Jan 2005 12:35:05 -0800, lee <lee@discussions.microsoft.com> wrote:

Cleaning up a new (to me) environment. I'm looking for a way to enumerate the
members of the Local Administrators group and then list the members of any
security groups in the Admin group by user name.
I've got a script to list the members but can't get the security
group listing (Like sql_dba members) and their names.

Thanks for any help you can provide.


See the script at tip 8875 in the 'Tips & Tricks' at http://www.jsiinc.com
(http://www.jsiinc.com/SUBR/tip8800/rh8875.htm)


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



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



Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB