The ForEach-Object cmdlet performs an operation on each item in an array of input objects. There are two methods to implement the ForEach command; 1. $Range | ForEach-Object {}2. ForEach ($Number in $Range) {} Both methods perform the same actions with the same outcome, but they do their job in a different way. In this…
Clean JSON output for ConvertTo-Json
PowerShell 5.1 has nice cmdlet called ConvertTo-Json that converts objects to JSON syntax. Unfortunately, this conversion isn’t very clean. It contains tons of extra white space and querying JSON is not possible for most of the tools including PowerShell. PowerShell-Core 7 received a major update on cmdlet. It actually converts objects into clean JSON code.…