Exchange "MultiValuedProperty" to string
i need capture active email address policies each user in exchange using in .csv file. problem having property "policiesincluded" multivaluedproperty" , not returning attributes looking for. have idea how can fix this?
$colitems = get-mailbox | select-object name,servername,policiesincluded $groupitems = @() foreach ($colitem in $colitems) { $username = $colitem.name $severname = $colitem.servername $policy = $colitem.policiesincluded $grpitems = new-object -typename psobject -property @{ username = $username servername = $servername policy = $policy } $groupitems += $grpitems } $groupitems | select-object username,servername,policy | sort-object -property username | export-csv $csvfile -notypeinformation
this nested loop. creates csv file has 1 row each enabled mailbox policy.
at least think will. don't have bandwidth test right now, clarifies "nested loop" means.
$colmbx = get-mailbox | {$_.emailaddresspolicyenabled -eq "true"} | select-object name,policiesincluded &{foreach ($mbx in $colmbx) { foreach ($mbxpol in $mbx.policiesincluded) { new-object psobject -property @{name=$mbx.name;policy=$mbxpol} } } }|export-csv enabledpolicies.csv -notypeinformation [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Windows Server > Windows PowerShell
Comments
Post a Comment