Hi,
Im new to working with objects so please bear with me. I have created a powershell script that calls an API to get some data.
The data is in a System array with Cusom objects and I need to add new member with uniqe values for each object.
I have only managed to add the same member value to each object. Can someone please help me with a solution for this and maybe have a link to good reading about objects like this.
My system array / objects:
Code:
$response | ForEach-Object {
$capacity = ($_.capacitybytes) / 1GB
$free = ($_.freespacebytes) / 1GB
$used = ($capacity - $free)
$response | Add-Member -NotePropertyName UsedSpaceGB -NotePropertyValue $used -Force
}
$response
Add-member is adding the same value to all objects. How can I add-member or noteproperty on each object with the correct value?
Later on I also want to update other members with new values.
thanks, and sorry for bad explanation. I have not very much experience as you might see.
