Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
This PowerShell script is designed to gather detailed information about a list of computers, including their manufacturer, model, and BIOS serial number. The information is then exported to a CSV file for easy reference. This script is particularly useful for IT administrators who need to inventory hardware details across multiple machines in a network.
The script reads a list of computer names from a text file (computers.txt
), queries each computer using WMI (Windows Management Instrumentation) to gather the necessary details, and then outputs this information into a CSV file (devices.csv
). This CSV file can be used for further analysis, reporting, or record-keeping.
Examples:
Prepare the Computers List:
computers.txt
with the names of the computers you want to query, one per line. For example:
PC1
PC2
PC3
PowerShell Script Explanation:
computers.txt
.$devices
to store the collected information.Get-WmiObject
cmdlet.$devices
array.devices.csv
.Executing the Script:
computers.txt
file..\Get-DeviceInfo.ps1
devices.csv
file containing the collected information.Script Code:
$computers = Get-Content -Path "computers.txt"
$devices = @()
foreach ($computer in $computers) {
$info = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $computer
$bios = Get-WmiObject -Class Win32_BIOS -ComputerName $computer
$devices += [PSCustomObject]@{
Manufacturer = $info.Manufacturer
Model = $info.Model
SerialNumber = $bios.SerialNumber
}
}
$devices | Export-Csv -Path "devices.csv" -NoTypeInformation