I am rather new to PowerShell and I'm sure the script gods will have a hay day picking this apart, or reject it out of hand. I have read a lot of documentation regarding creating objects, and assigning members to the objects. A lot of posts are very similar, but I have yet to find one that answers my question directly.
The following is an example of what I'm trying to achieve.
$MGSet = New-Object -TypeName PSObject
$MgmtSet = New-Object -TypeName Cmdlet.WebService.MgInfo
$MgmtSet.Param1 = $true
$MgmtSet.Param2 = $false
$MgmtSet.oParam = [Cmdlet.WebService.ParamBase] @{
$PB.differentParam = "Testname"
$PB.DiffParam2 = $false
$PB.oDifParamOb = Add-Member -InputObject $MGset - MemberType NoteProperty -Name oDifParamOb -Value ("sys1", "Sys2", "Sys3")
}
First I know this is wrong, but the idea is the Parent object has an object as one of the parameters. Furthermore, the new object also has an embedded object: Parentobject > childobject > baseobject
If I were to execute ...
$MgmtSet = New-Object -TypeName Cmdlet.WebService.MgInfo
$MgmtSet
I would get
ExtensionData :
Param1 : True
Param2 : False
oParam : {Cmdlet.WebService.ParamBase}
On the same token if I execute
$MgmtSet = New-Object -TypeName Cmdlet.WebService.ParamBase
$MgmtSet
I would get
ExtensionData :
differentParam : Testname
DiffParam2 : False
oDifParamOb :
The goal is to assign values to the embedded objects and pass it to the parent object. I can use an Array, or a Hash table, but assigning those objects to the parent is where I fall short.
Thank you ahead of time.