Hi,
I am having a bit of problems conceptualising how to produce a custom object that has multiple values in a property.
I am using these two variables
$UpdateAssignment = Get-WmiObject -Query "Select * from CCM_AssignmentCompliance" -Namespace root\ccm\SoftwareUpdates\DeploymentAgent -Computer $computer -ErrorAction Stop $UpdateCIAssigment = Get-WmiObject -Query "SELECT * FROM CCM_UpdateCIAssignment" -Namespace "ROOT\ccm\policy\machine\Actualconfig" -ComputerName $computer -ErrorAction Stop
These are SCCM related information. I am particular interested in mixing up the property values of iscompliant in $updateassignment variable and assignmentname in $updateciassignment.
From my knowledge This will work all fine and dandy if there was one value but there are multiple values of these properties.
So I am getting an array within propertynames like this when I create an object:
Compliant Software
--------- --------
{True, True} {Microsoft Software Updates - 2015-10-03 10:31:05 PM, Microsoft Software Updates - 2016-05-01 09:58:44 AM}
I thought creating another object with foreach might work but to no avail.
$icomplianceitem =@{}
foreach ($item in $Complianceobject){
$icomplianceitem = New-Object -TypeName psobject -Property @{
‘Software’ =$item.SoftwareName
‘Compliant’ =$item.Compliant
}
}
How would I iterate through the various items so I get a collection with seperate objects and not in an array.
Many thanks in advance.