Seth
Seth

Reputation: 23

Object properties and Variables

What I am working with is this (Exchange online powershell):

get-publicfolder -Identity "\TestFolder" -Recurse|Where{$_.mailenabled -eq "true"}

So what I am interested in is getting the parentpath and name properties from that. How do I assign that to a variable so parentpath and name are on the same line Right now if I do

$myvar = $MailEnabledFolder.parentpath,$MailEnabledFolder.name

Then the variable is built like:

I want it to be

Thank you

Upvotes: 2

Views: 55

Answers (1)

mklement0
mklement0

Reputation: 437197

Your $MailEnabledFolder.parentpath and $MailEnabledFolder.name values are apparently arrays of values, so you must process them in pairs:

$array1 = $MailEnabledFolder.parentpath
$array2 = $MailEnabledFolder.name

foreach ($i in 0..($array1.Count-1)) {
  Join-Path $array1[$i] $array2[$i]
}

Upvotes: 1

Related Questions