none
Inventory RRS feed

คำตอบ

  • Perhaps there are multiple profiles on the machine?

    Try this:

    $computer = Get-Content .\computerlist.txt
    $Output = Foreach($C in $computer){
        $System = Get-WmiObject Win32_ComputerSystem -ComputerName $C | Select-Object -Property Name
        $BIOS = Get-WmiObject Win32_BIOS -ComputerName $C | Select-Object -Property SerialNumber
        $DomainUsers = (Get-WmiObject Win32_NetworkLoginProfile -ComputerName $C).name -join ";"
        [PSCustomObject]@{
                ComputerName = $C
                Name = $System.Name
                SerialNumber = $BIOS.SerialNumber
                Users = $DomainUsers
            }
    }
    $Output
    $Output |Export-Csv -Path .\Result.csv -NoTypeInformation -Append


    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)





    18 เมษายน 2562 15:50
  • You're correct. I've edited my post with corrected code.

    The correct line should have been (without the " | select name") :

    $DomainUsers=(Get-WmiObject Win32_NetworkLoginProfile -ComputerName $C).name -join ";"


    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)


    18 เมษายน 2562 17:47

ตอบทั้งหมด