![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 | Getting CSV dump of AD objects with certain attribute values Every week I dump out certain exchange related AD objects (users, groups, & contacts) to a CSV file along with relevant attribute values (proxyAddresses, homeMDB, etc). I use these dumps to keep a historical record of objects as I frequently get asked about past object attributes (what group was this user in 6 months ago, what server/database was their mailbox on, etc). I used to do this with a hacked batch file that a ROSS engineer showed me when doing one of our ExRAP's. Then when powershell RC1 came out I converted to that (especially since csvde has a lot of problems when dumping AD). I figured out how to do it with RC1 thanks to MOW's excellent powershell AD blog posts, but now that RTM is out I need to figure out how to do this all over again since I'm moving this function off of my desktop and onto a production server. Here is how I was doing it with RC1 (this is the User dump script, I also have seperate scripts for groups and contacts): -- $domain = New-Object System.DirectoryServices.DirectoryEntry $DN1 = (get-content C:\TempLocation_for_webposting\DN-import.txt) # list of OU's I want dumped out $DN2 = $DN1 | foreach { $domain.get_children().find($_) } filter Format-DumpADUser { $_ | select @{name='distinguishedName';Expression={$_.distinguishedName} }, @{ name='homeMDB'; Expression={$_.homeMDB} }, @{ name='displayName'; Expression={$_.displayName} }, @{ name='mail'; Expression={$_.mail} }, @{ name='legacyExchangeDN'; Expression={$_.legacyExchangeDN} }, @{ name='proxyAddresses'; Expression={$_.proxyAddresses} }, @{ name='memberOf'; Expression={$_.memberOf} }, @{ name='whenChanged'; Expression={$_.whenChanged} }, @{ name='whenCreated'; Expression={$_.whenCreated} }, @{ name='mailNickname'; Expression={$_.mailNickname} }, @{ name='mDBUseDefaults'; Expression={$_.mDBUseDefaults} }, @{ name='mDBOverQuotaLimit'; Expression={$_.mDBOverQuotaLimit} }, @{ name='mDBStorageQuota'; Expression={$_.mDBStorageQuota} } } $DN2 | foreach { $_.get_children() } | Format-DumpADUser | export-csv -NoTypeInformation C:\TempLocation_for_webposting\userDump.csv -- I did some research on the new ADSI wrapper and tried to get started, but once I mapped a paticular OU ($MyOU=[ADSI]"LDAP://server:389/OU=ChildOU,ParentOU,DC=domain,DC=com") I couldn't figure out how to get a list of the objects in it, .get_children() doesn't seem to work anymore. Is there some way around this, or some new way to do things in AD? p.s. I have absolutely no programming or scripting experience except the few powershell things I've done over the past few months, so please be kind when explaining things. |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Getting CSV dump of AD objects with certain attribute values you need to add PSbase to get arround the wrapper like : $domain.get_children().find($_) --> $domain.PSBase.Children.find($_) for more info see this 2 blogentries I made about the changes : http://mow001.blogspot.com/2006/09/p...directory.html part 1 http://mow001.blogspot.com/2006/09/p...ectory_29.html part 2 Glad to hear my blog was at help before Greetings /\/\o\/\/ "sbq" <sbq@discussions.microsoft.com> wrote in message news:8F5605EA-9C01-407F-82AF-B731321E9291@microsoft.com... > Every week I dump out certain exchange related AD objects (users, groups, > & > contacts) to a CSV file along with relevant attribute values > (proxyAddresses, > homeMDB, etc). I use these dumps to keep a historical record of objects > as I > frequently get asked about past object attributes (what group was this > user > in 6 months ago, what server/database was their mailbox on, etc). > > I used to do this with a hacked batch file that a ROSS engineer showed me > when doing one of our ExRAP's. Then when powershell RC1 came out I > converted > to that (especially since csvde has a lot of problems when dumping AD). I > figured out how to do it with RC1 thanks to MOW's excellent powershell AD > blog posts, but now that RTM is out I need to figure out how to do this > all > over again since I'm moving this function off of my desktop and onto a > production server. Here is how I was doing it with RC1 (this is the User > dump script, I also have seperate scripts for groups and contacts): > > -- > $domain = New-Object System.DirectoryServices.DirectoryEntry > $DN1 = (get-content C:\TempLocation_for_webposting\DN-import.txt) # list > of > OU's I want dumped out > > $DN2 = $DN1 | foreach { > $domain.get_children().find($_) > } > > filter Format-DumpADUser { > $_ | select > @{name='distinguishedName';Expression={$_.distinguishedName} }, > @{ name='homeMDB'; Expression={$_.homeMDB} }, > @{ name='displayName'; Expression={$_.displayName} }, > @{ name='mail'; Expression={$_.mail} }, > @{ name='legacyExchangeDN'; Expression={$_.legacyExchangeDN} }, > @{ name='proxyAddresses'; Expression={$_.proxyAddresses} }, > @{ name='memberOf'; Expression={$_.memberOf} }, > @{ name='whenChanged'; Expression={$_.whenChanged} }, > @{ name='whenCreated'; Expression={$_.whenCreated} }, > @{ name='mailNickname'; Expression={$_.mailNickname} }, > @{ name='mDBUseDefaults'; Expression={$_.mDBUseDefaults} }, > @{ name='mDBOverQuotaLimit'; Expression={$_.mDBOverQuotaLimit} }, > @{ name='mDBStorageQuota'; Expression={$_.mDBStorageQuota} } > } > > $DN2 | foreach { > $_.get_children() > } | Format-DumpADUser | export-csv -NoTypeInformation > C:\TempLocation_for_webposting\userDump.csv > > -- > > I did some research on the new ADSI wrapper and tried to get started, but > once I mapped a paticular OU > ($MyOU=[ADSI]"LDAP://server:389/OU=ChildOU,ParentOU,DC=domain,DC=com") I > couldn't figure out how to get a list of the objects in it, > .get_children() > doesn't seem to work anymore. Is there some way around this, or some new > way > to do things in AD? > > p.s. I have absolutely no programming or scripting experience except the > few > powershell things I've done over the past few months, so please be kind > when > explaining things. |
My System Specs![]() |
| | #3 (permalink) |
| Guest | RE: Getting CSV dump of AD objects with certain attribute values MOW has an excellent series on the new ADSI wrapper. I believe the answer to your immediate question is $MyOU.psbase.children "sbq" wrote: > Every week I dump out certain exchange related AD objects (users, groups, & > contacts) to a CSV file along with relevant attribute values (proxyAddresses, > homeMDB, etc). I use these dumps to keep a historical record of objects as I > frequently get asked about past object attributes (what group was this user > in 6 months ago, what server/database was their mailbox on, etc). > > I used to do this with a hacked batch file that a ROSS engineer showed me > when doing one of our ExRAP's. Then when powershell RC1 came out I converted > to that (especially since csvde has a lot of problems when dumping AD). I > figured out how to do it with RC1 thanks to MOW's excellent powershell AD > blog posts, but now that RTM is out I need to figure out how to do this all > over again since I'm moving this function off of my desktop and onto a > production server. Here is how I was doing it with RC1 (this is the User > dump script, I also have seperate scripts for groups and contacts): > > -- > $domain = New-Object System.DirectoryServices.DirectoryEntry > $DN1 = (get-content C:\TempLocation_for_webposting\DN-import.txt) # list of > OU's I want dumped out > > $DN2 = $DN1 | foreach { > $domain.get_children().find($_) > } > > filter Format-DumpADUser { > $_ | select @{name='distinguishedName';Expression={$_.distinguishedName} }, > @{ name='homeMDB'; Expression={$_.homeMDB} }, > @{ name='displayName'; Expression={$_.displayName} }, > @{ name='mail'; Expression={$_.mail} }, > @{ name='legacyExchangeDN'; Expression={$_.legacyExchangeDN} }, > @{ name='proxyAddresses'; Expression={$_.proxyAddresses} }, > @{ name='memberOf'; Expression={$_.memberOf} }, > @{ name='whenChanged'; Expression={$_.whenChanged} }, > @{ name='whenCreated'; Expression={$_.whenCreated} }, > @{ name='mailNickname'; Expression={$_.mailNickname} }, > @{ name='mDBUseDefaults'; Expression={$_.mDBUseDefaults} }, > @{ name='mDBOverQuotaLimit'; Expression={$_.mDBOverQuotaLimit} }, > @{ name='mDBStorageQuota'; Expression={$_.mDBStorageQuota} } > } > > $DN2 | foreach { > $_.get_children() > } | Format-DumpADUser | export-csv -NoTypeInformation > C:\TempLocation_for_webposting\userDump.csv > > -- > > I did some research on the new ADSI wrapper and tried to get started, but > once I mapped a paticular OU > ($MyOU=[ADSI]"LDAP://server:389/OU=ChildOU,ParentOU,DC=domain,DC=com") I > couldn't figure out how to get a list of the objects in it, .get_children() > doesn't seem to work anymore. Is there some way around this, or some new way > to do things in AD? > > p.s. I have absolutely no programming or scripting experience except the few > powershell things I've done over the past few months, so please be kind when > explaining things. |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Getting CSV dump of AD objects with certain attribute values Thanks! this did the trick. "/\/\o\/\/ [MVP]" wrote: > you need to add PSbase to get arround the wrapper like : > > $domain.get_children().find($_) > > --> > > $domain.PSBase.Children.find($_) > > for more info see this 2 blogentries I made about the changes : > http://mow001.blogspot.com/2006/09/p...directory.html > part 1 > http://mow001.blogspot.com/2006/09/p...ectory_29.html > part 2 > > Glad to hear my blog was at help before > > Greetings /\/\o\/\/ > > "sbq" <sbq@discussions.microsoft.com> wrote in message > news:8F5605EA-9C01-407F-82AF-B731321E9291@microsoft.com... [snip] |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| User attribute | Ian_1 | PowerShell | 10 | 05-27-2008 09:06 AM |
| Getting all values out of an array of objects | casey.daniell | PowerShell | 6 | 02-22-2008 09:57 AM |
| How to insert the "modified time" attribute in "date taken" attribute in batch mode-in vista or theough a software? | paltry | Vista file management | 0 | 11-08-2006 03:06 PM |
| What is file attribute N? | Chris | Vista General | 0 | 06-27-2006 02:16 PM |