Quick System Info – Powershell

Here is a PowerShell script to get basic system inventory information about your computers and parse it into CSV format.
Tested on Dell,HP, and Lenovo systems.

$MyArray = $null
$MyArray = @()
$ComputerList = Get-Content "C:\Scripts\Computers.txt"
ForEach ($Computer in $ComputerList){
COMP = $Computer
$MyObj = "" | Select "Computer","Manufacturer","Model","ServiceTag","Memory","HDSerial","User"
$MyObj.Computer = $COMP
$MyObj.Manufacturer = Get-WmiObject Win32_BIOS -Computer $COMP |Select -ExpandProperty Manufacturer
$MyObj.Model = Get-WmiObject Win32_ComputerSystem -Computer $COMP |Select -ExpandProperty Model
$MyObj.ServiceTag = Get-WmiObject Win32_BIOS -Computer $COMP |Select -ExpandProperty SerialNumber
$MyObj.Memory = Get-WmiObject Win32_ComputerSystem -Computer $COMP |Select -ExpandProperty TotalPhysicalMemory
$MyObj.HDSerial = Get-WmiObject Win32_PhysicalMedia -Computer $COMP |Where-Object {$_.tag -like "*PHYSICALDRIVE0*"} |select -ExpandProperty SerialNumber
$MyObj.User = Get-WmiObject Win32_ComputerSystem -Computer $COMP |Select -ExpandProperty UserName
$MyArray += $MyObj
$MyObj = $null
}
$MyArray |export-csv "C:\Scripts\ComputerReport.csv"

Quick System Info – BASH

Here is a BASH script to get basic system inventory information about your computer and parse it into CSV format.

#!/bin/bash
FIELDS="\"ComputerName\",\"Manufacturer\","
FIELDS+="\"Model\",\"ServiceTag\",\"Memory\","
MYHOSTNAME="$(hostname)"
MANUFACTURER="$(dmidecode -s system-manufacturer)"
MODEL="$(dmidecode -s system-product-name)"
SERVICETAG="$(dmidecode -s system-serial-number)"
MEMORY="$(free |grep "Mem:" |awk '{print $2}')"
MYINFO=\""${MYHOSTNAME}"\",\""${MANUFACTURER}"\",
MYINFO+=\""${MODEL}"\",\""${SERVICETAG}"\",
MYINFO+=\""${MEMORY}"\",
echo "${FIELDS}"$'\n'"${MYINFO}"