I'm attaching my object exported to xml
________________________________ From: [email protected] [[email protected]] on behalf of Kelley, Matthew [[email protected]] Sent: Friday, October 30, 2015 2:27 PM To: [email protected] Cc: Catlett, Christopher Subject: RE: [powershell] help with hash tables. Maybe something like this? foreach ($item in $apvgroups.GetEnumerator()){$output += "$($item.Name), $(foreach($i in $item.value){$i + ','})"} out-file -FilePath c:\windows\temp\output.csv -InputObject $output -Append From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Friday, October 30, 2015 2:08 PM To: [email protected] Subject: RE: [powershell] help with hash tables. Now, how can I export this as a csv? I'm getting the below results: "value","name" "FA-EQIS APV Sewer","System.Object[]" "FA-APV - Personnel Database", "AA-APV manifest.apvcentral.com","System.Object[]" "AA-APV Database - Mileage Summary","NICOLE_C" "FA-EQIS APV Linden Operations","System.Object[]" "FA-EQIS APV Northern PA Operations","System.Object[]" "FA-EQIS APV Brooklyn Operations","System.Object[]" "AA-APV Database - Roll Off Boxes","ROBERT_M" "AA-APV payroll.apvcentral.com","System.Object[]" "SMSG-APVPARTS", "AA-APV Database - Meters","System.Object[]" "FA-APV Data Copy (8_25_2015)","System.Object[]" "FA-EQIS APV Billing","NATASHAC" Works great if there is only one user, but not if multiple users are in the group. How do I get it to expand the system object? ________________________________ From: Catlett, Christopher Sent: Friday, October 30, 2015 1:38 PM To: [email protected]<mailto:[email protected]> Subject: RE: [powershell] help with hash tables. $apvgroups.add($group,$groupinfo.SamAccountName) worked. ________________________________ From: [email protected]<mailto:[email protected]> [[email protected]] on behalf of Emin [[email protected]] Sent: Friday, October 30, 2015 1:20 PM To: [email protected]<mailto:[email protected]> Subject: Re: [powershell] help with hash tables. hi, What about inverting select and where and using expand $groupinfo = Get-ADGroupMember -Identity $group | Where-Object {($_.samaccountname -notin $users) -and ($_.samaccountname -notin $excludeusers)} | select -expand samaccountname On Fri, Oct 30, 2015 at 5:40 PM, <[email protected]<mailto:[email protected]>> wrote: $apvgroups = $null $apvgroups = @{} foreach ($group in $groups) { $groupinfo = Get-ADGroupMember -Identity $group | select samaccountname | Where-Object {($_.samaccountname -notin $users) -and ($_.samaccountname -notin $excludeusers)} $apvgroups .add($group,$groupinfo) } Here is the output i'm getting: PS C:\Windows\system32> $apvgroups Name Value ---- ----- FA-EQIS APV Sewer {@{samaccountname=ED_TH}, @{samaccountname=BILL_J}, @{samaccountname=SCOTT_SY}, @{samaccountname=DAN_CO}} FA-APV - Personnel Database AA-APV manifest.apvcentral.com<http://manifest.apvcentral.com> {@{samaccountname=NICOLE_C}, @{samaccountname=SCOTTMCK}, @{samaccountname=JAMES_ME}, @{samaccountname=IRIS_D}} AA-APV Database - Mileage S... @{samaccountname=NICOLE_C} FA-EQIS APV Linden Operations {@{samaccountname=DAN_CO}, @{samaccountname=BRYANNAG}, @{samaccountname=MARY_KU}} FA-EQIS APV Northern PA Ope... {@{samaccountname=MARC_F}, @{samaccountname=SCOTTMCK}, @{samaccountname=DAN_CO}, @{samaccountname=JAMES_L}...} FA-EQIS APV Brooklyn Operat... {@{samaccountname=BISI_A}, @{samaccountname=KRIS_B}, @{samaccountname=NICOLE_C}, @{samaccountname=SHAWN_H}...} I just want the samaccountname values inserted into the hashtable. ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1
ÿþ<