Could this be blocking Pcs remotely returning information or have i dont something wrong?

27 Views Asked by At
$computers = Import-Csv “C:\Temp\computers.csv” | ForEach { 
    $computerSystem = Get-WmiObject Win32_ComputerSystem -Name $_.Name
    $computerOS = Get-WmiObject Win32_OperatingSystem -Name $_.Name
    $computerCPU = Get-WmiObject Win32_Processor -Name $_.Name
    $computerSN = Get-WmiObject Win32_bios -Name $_.Name | Select-Object SerialNumber

    [PSCustomObject]@{    
        'PCName' = $computerSystem.Name    
        'Model'  = $computerSystem.Model   
        'RAM'    = "{0:N2}" -f ($computerSystem.TotalPhysicalMemory / 1GB)    
        'CPU'    = $computerCPU.Name    
        'OS'     = $computerOS.caption
        'SN'     = $computerSN.SerialNumber
        'User'   = $computerSystem.UserName
    }
} | Export-Csv 'C:\Temp\system-info.csv' -NoTypeInformation

I used this as my powershell code, (copied bits from others - my csv file has 267 PC names in it - running as admin have admin rights (Also ran on a DC) ) but i am only getting 267 lines of my pn name and all the information i need - have a missed something or done something wrong here. any help greatly appreicetated

(New to powershell so still learning)

I expected to have 267 PC names seriel numbers, RAM, last loged in user. instead i am getting 267 rows of the same information from my pc

0

There are 0 best solutions below