I'm trying to set a child property in a custom object using a parent property.
$objServer = New-Object PSObject -Property @{
Name = "Some Name";
BaseFilePath = "c:\somepath"
Section1 = New-Object PSObject -Property @{
FilePath=$objServer.BaseFilePath + '\' + $objServer.Name + '\section1';
AncestorId="557309";
Title="Section 1";
Enabled=$processFlag1;
}
Section2 = New-Object PSObject -Property @{
FilePath={$_.Parent.BaseFilePath} + '\' + {$_.Parent.Name} + '\' + '\section2';
AncestorId="557319";
Title="Tables";
Enabled=$processFlag2;
}
}
Section 1 and Section 2 are examples of syntax I've tried. Is this possible? What am I doing wrong?