Script has two variables when done, but when I pipe to SELECT-object only first one returns data to console

What you’re experiencing is merely a display problem: Both your Select-Object calls produce output objects with 4 or fewer properties whose types do not have explicit formatting data associated with them (as reported by Get-FormatData). This causes PowerShell’s for-display output formatting system to implicitly render them via the Format-Table cmdlet. The display columns that Format-Table … Read more

How do I write the value of a single property of a object?

qbanet359’s helpful answer uses direct property access (.LoadPercentage) on the result object, which is the simplest and most efficient solution in this case. In PowerShell v3 or higher this even works with extracting property values from a collection of objects, via a feature called member-access enumeration. E.g., ((Get-Date), (Get-Date).AddYears(-1)).Year returns 2019 and 2018 when run … Read more

Create objects with custom properties containing derived filesystem path information and export them to a CSV – calculated properties

The [System.IO.FileInfo] instances returned by Get-ChildItem for files do not have Folder or FolderName properties. Get-ChildItem -File $HOME\Desktop | Get-Member, for instance, will show you the available properties, and will show you that the desired information can be derived from the PSPath and PSParentPath properties. Select-Object allows hashtable-based property definitions, so-called calculated properties, which allow … Read more