If I run the following command it displays my output in 2 columns like this:
collection name collection ID
collection name collection ID
Get-WmiObject -ComputerName sfrvmsccmcn1 -Namespace "root\SMS\Site_CN1" -Query "Select * from SMS_Collection" | Select-Object -Property Name, CollectionID
BUT.....when I assign this command to a variable and then use Write-Host it changes the format.
This code:
$READ = Get-WmiObject -ComputerName sfrvmsccmcn1 -Namespace "root\SMS\Site_CN1" -Query "Select * from SMS_Collection" | Select-Object -Property Name, CollectionID
Write-Host $Read
will write all data to 1 line.
collection name collection ID, collection name collection ID, collection name collection ID, etc.....
Why? and how do I make it output to 2 columns? I've tried the -NewLine switch but it did not help.