header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

AD Formatting Output Question
Last Post 03 Aug 2008 10:41 AM by danjphillips. 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
danjphillipsUser is Offline
New Member
New Member
Posts:15

--
02 Aug 2008 12:45 PM  

I've installed the free Quest AD tools and running the following PS command to get all the SIDs in a group.

Get-QADGroupMember 'My Test Group' | select Sid

Sid                                                                                                                   
---
S-1-5-21-3362478587-226510628-1547701939-1121                                                                         
S-1-5-21-3362478587-226510628-1547701939-1129

This looks good.  When I run this code I get a strange format

$Group = "My Test Group"

$GroupMembers = Get-QADGroupMember -IncludeAllProperties $Group | select Sid

foreach ($member in $GroupMembers)

{

Write-Host $member

}

Here's what the output looks like.  Basically I want to be able to create a folder for each SID.  This is what looks strange.  What is the @Sid={} stuff?  How can I get rid of it.  Maybe you know of a better way to accomplish what I want to do. 

@Sid={S-1-5-21-3362478587-226510628-1547701939-1121}
@Sid={S-1-3362478587-226510628-1547701939-1129}

 

ShayUser is Offline
Basic Member
Basic Member
Posts:228

--
03 Aug 2008 08:36 AM  

 

If SID is all you need then there is no need to -IncludeAllProperties, it is quiet expensive in terms of performance since SID is included in the default set of retrieved proprieties. This notation @{} means that the object is of type Array.

This will create a folder for each SID:  

PS > Get-QADGroupMember administrators | new-item -type container -Path d:\sid -Name {$_.sid}

danjphillipsUser is Offline
New Member
New Member
Posts:15

--
03 Aug 2008 10:41 AM  

Works like a charm, thanks.

You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer