Truncate the values only - urgent :(

Hi Team,
Could you please assist me to clear the values only from a PSObject.


PS C:\Users\SagarJyo> $props=@{Name=“PS”;Tech=“Microsoft”}

PS C:\Users\SagarJyo> $Obj=New-Object psobject -Property $props

PS C:\Users\SagarJyo> $obj|fl

Tech : Microsoft
Name : PS


What I want is the names Tech & Name should become empty; if its not possible or cannot be emtpy then I want replace all by a specific string. Of course I can do like below each one by one… but in my actual case I have plenty of names and cannot hotcode. I am looking for a solution. pls help me asap.

PS C:\Users\SagarJyo> $obj.tech=“N/A”

PS C:\Users\SagarJyo> $obj|fl *

Tech : N/A
Name : PS

You can do something like this:

foreach ($property in $Obj.PSObject.Properties) {
    $property.Value = $null
}

wow. thats awesome. thnx Wyatt :slight_smile:

No problem. :slight_smile: