not mine. got it from the corners of the nets. very useful for me, did some modifications for my use.

this will list remote PC information.

# Remote System Information
# Shows hardware and OS details from a list of PCs
# Thom McKiernan 22/08/2014
#
# modified by me: Dec 17, 2017
# to change filter to "DeviceID='C:'" for those computers with more than one partition or drives
# also to read input from CSV and to output to CSV; much more flexible format
#

$ArrComputers =  Import-Csv D:\scripts\ADcomputers.csv

Clear-Host
foreach ($Computer in $ArrComputers)
{  
    echo $Computer
    $computerSystem = get-wmiobject Win32_ComputerSystem -Computer $Computer
    $computerBIOS = get-wmiobject Win32_BIOS -Computer $Computer
    $computerOS = get-wmiobject Win32_OperatingSystem -Computer $Computer
    $computerCPU = get-wmiobject Win32_Processor -Computer $Computer
    $computerHDD = Get-WmiObject Win32_LogicalDisk -ComputerName $Computer -Filter "DeviceID='C:'"

    $csvObject = New-Object PSObject -property @{
        'PCName' = $computerSystem.Name
        'Manufacturer' = $computerSystem.Manufacturer
        'Model' = $computerSystem.Model
        'SerialNumber' = $computerBIOS.SerialNumber
        'RAM' = "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB)
        'HDDSize' = "{0:N2}" -f ($computerHDD.Size/1GB)
        'HDDFree' = "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size)
        'CPU' = $computerCPU.Name
        'OS' = $computerOS.caption
        'SP' = $computerOS.ServicePackMajorVersion
        'User' = $computerSystem.UserName
        'BootTime' = $computerOS.ConvertToDateTime($computerOS.LastBootUpTime)
    }

#Export the fields you want from above in the specified order
$csvObject | Select-Object PCName, Manufacturer, Model, SerialNumber, HDDSize, CPU, Ram, OS, SP | Export-Csv 'd:\scripts\PCinfo.csv' -NoTypeInformation -Append

}
# Open CSV file for review (leave this line out when deploying)
#notepad system-info.csv
9 Spice ups

Sounds like a good script, or you can run it against all your workstations in AD as well without the CSV.

It should be

# all computers

$ArrComputers=get-adcomputer -filter * |select -exp Name
#only servers
get-adcomputer -filter {operatingsystem -like '*server*'} |select -exp Name

@badbanana share your script here

https://community.spiceworks.com/scripts

2 Spice ups

The problem with it is you have to edit the text file first and THEN run the script. Better to just run the script and provide it parameters. I did something similar and allow parameters, pipeline, even pipeline from Get-ADComputer.

This is a nice script, but you really need to turn it into a tool.

That means:

  1. Refactoring the core of the code into one or more functions

  2. Decorating those functions with all the relevant atttributes for the paramaters.

  3. Adding comment based help into the functions

  4. Packaging the functions into a module.

  5. Write a controller script that accepts user input - either as a GUI OR a CSV and gets the relevant info.