Solved

Powershell list attributes

Posted on 2009-07-13
3
1,151 Views
Last Modified: 2012-05-07

For a WMI object, I can list all the values for an oject with this;
get-WmiObject win32_bios -comp server | Select-Object *

what is the command to have powershell list all the attributes (CN, sid, etc...) for a group?
what is the command to have powershell list all the attributes (CN, sid, etc...) for a user?
how does this change if I wanted to ask it about an AD user or group?
0
Comment
Question by:loftyworm
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
Learnctx earned 500 total points
ID: 24845625
You could try some of the ones below. I'm not actually near an AD environment at the moment, but from memory one of these should do the trick.

$objUser = [ADSI]"LDAP://cn=userid,ou=useraccountsou,dc=test,dc=lab"

$objUser | format-list *
 

$objGroup = [ADSI]"LDAP://cn=groupname,ou=groupsou,dc=test,dc=lab"

$objGroup | format-list *
 

$searcher = new-object directoryservices.directorysearcher

$searcher.pagesize = 999

$searcher.filter = "name=groupname"

$searcher.FindAll() | Foreach-Object {$_.Properties | fl *}

Open in new window

0
 
LVL 11

Author Comment

by:loftyworm
ID: 24851499
Is there an easy way to find the DN for a user or group?

0
 
LVL 11

Author Comment

by:loftyworm
ID: 24862273
the easy way to get the DN was with the DS command;
dsquery user domainroot -name *smith
dsquery group domainroot -name *smith
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Synchronize a new Active Directory domain with an existing Office 365 tenant
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

919 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now