PS C:\Software\Scripts> .\Get-RegisterType.ps1
cmdlet Get-RegisterType at command pipeline position 1
Supply values for the following parameters:
computername: 20061sure03
20061sure03 is online
Model Name
4800E42 20061SURE03
It outputs this
Get-WmiObject -Class win32_ComputerSystem -ComputerName $computername | Select-Object -Property Model, Name
When you’re querying multiple sources, you want to combine whatever you want into a single output thing. This is part of the fundamental narrative of “Learn PowerShell Scripting in a Month of Lunches,” if you’d like to dive into it in more detail. I use the above example, almost exactly, throughout the entire book, in fact.
Powershell is implicitly outputting to format-table. So after it has one set of columns decided on, it won’t display another set of columns. This was a gotcha for me when I was learning.