I have this code that works.
$pc = "MyPC"
$results = @()
foreach ($machine in $pc) {
$caption = (Get-WMIObject -Class Win32_Operatingsystem -ComputerName $machine).caption
$computerName = Get-WMIObject -class Win32_ComputerSystem -computername $machine | Select-Object -ExpandProperty name
$computerOS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $machine | Select-Object -ExpandProperty version
$getip = ([version](Test-Connection $machine -Count 1).IPV4Address.IPAddressToString).Build;
$desc = (Get-ADComputer $machine -Properties Description).description
$BIOSVer = (Get-WmiObject -Class Win32_BIOS -Property SMBIOSBIOSVersion).SMBIOSBIOSVersion
$results += New-Object PSObject -Property:@{PCName=$computerName;'OS Version'=$ComputerOS;'OS Type'=$caption;'IP vLan'= $getip;'Description'=$desc;'BIOS Version'=$BIOSVer}}
$results
The issue is the output. It does not display in the order I list on my $results line. How come?