![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | How go generate a pipeline from a script? Hello, I've been trying to generate a list of AD accounts from a script and export that to a pipeline so I can create a set of script-lets to manage data from AD. I haven't been able to figure out how to take the list of accounts generated from the script and push them out to the pipleline to I can pipe them into another script. Here's the code from my test script. Anyone have any ideas how move the data to the pipe line? Thanks, Bob # Connect to AD $strNewco = "LDAP://DC=newco;DC=local" $objNewco = New-Object DirectoryServices.DirectoryEntry $strNewco # Create a selector for AD $objSelect = New-Object DirectoryServices.DirectorySearcher $objSelect.SearchRoot = $objNewco # Collect all the matching objects $objHosts = $objSelect.findall() | Where-Object {$_.properties.objectcategory -match "CN=Person"} |
My System Specs![]() |
| | #2 (permalink) |
| Scripting Guru ![]() Rep Power: 8 ![]() ![]() ![]() | Re: How go generate a pipeline from a script? I think the issue is that your searcher object is failing. You should use a filter for the searcher object. It will be more efficient than getting all objects and then piping to Where. Here's an example: $searcher=New-object DirectoryServices.DirectorySearcher $searcher.SearchRoot="LDAP://OU=Testing,DC=jdhitsolutions,DC=local" $searcher.Filter="(&(objectcategory=person)(objectclass=user))" $users=$searcher.FindAll() #display the number of users Write-Host "There are "$users.count"users in this domain." #display each user's distinguishedname foreach ($user in $users) { Write-Host $user.properties.distinguishedname write-host $user.Properties.description } |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Generate script | oyvind | VB Script | 1 | 05-20-2008 09:05 AM |
| Using WPF to Generate an Image | Tem | Avalon | 5 | 11-15-2007 11:22 AM |
| Generate an Image with WPF | Tem | Avalon | 0 | 10-31-2007 04:50 PM |
| Bug spreading pipeline commands across multiple lines in a script | Keith Hill [MVP] | PowerShell | 8 | 05-03-2007 10:17 PM |
| Script to generate help for all cmdlets | George Davis | PowerShell | 0 | 03-02-2007 07:43 AM |