Difference between revisions of "Programming:Windows PowerShell"

From WhyAskWhy.org Wiki
Jump to: navigation, search
(Stub page for PowerShell scripts/tools)
 
m (Added alternate (non-PowerShell) command)
Line 14: Line 14:
 
Get-ADGroupMember "MyADGroupName" | Select-Object name | Sort-Object name
 
Get-ADGroupMember "MyADGroupName" | Select-Object name | Sort-Object name
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Unfortunately that doesn't expand all group members, whereas this command-line tool does:
 +
 +
<code>
 +
dsquery group -name "MyADGroupName" | dsget group -members -expand
 +
</code>
  
  

Revision as of 10:07, 13 September 2012



Look up Active Directory group members

I found this tip on ServerFault.com.

Import-Module ActiveDirectory
Get-ADGroupMember "MyADGroupName" | Select-Object name | Sort-Object name

Unfortunately that doesn't expand all group members, whereas this command-line tool does:

dsquery group -name "MyADGroupName" | dsget group -members -expand


Links