Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Script to pull Bios information from a list of Computer Names

$
0
0

Hello, 

I was wondering if I could get help with a powershell script to pull bios information from a list of computer names in a text file then export that info into a .csv file. 

#* FUNCTION LISTING

#*=============================================================================

#* Function:    BIOSInfo

##*=============================================================================

#* Purpose: WMI Function that enumerate win32_BIOS properties

#*

#*

#*=============================================================================

Function BIOSInfo {

$colItems = Get-WmiObject Win32_BIOS -Namespace “root\CIMV2? -computername $strComputer

foreach($objItem in $colItems) {

Write-Host “BIOS:”$objItem.Description

Write-Host “Version:”$objItem.SMBIOSBIOSVersion”.”`

$objItem.SMBIOSMajorVersion”.”$objItem.SMBIOSMinorVersion

Write-Host “Serial Number:” $objItem.SerialNumber

Write-Host "Product Number:" $objItem.ProductNumber

}

}

#*=============================================================================

#* SCRIPT BODY

#*=============================================================================

#* Create and array from C:\Users\%Username%\Desktop\Computers1.txt

$arrComputers = get-Content -Path “C:\Users\%Username%\Desktop\Computers1.txt”

foreach ($strComputer in $arrComputers) {

$objCollection = Get-wmiobject -class Win32_BIOS -comp $strComputer

foreach ($objItem in $objCollection){

Write-Host “Computer Name:” $strComputer

write-host “Description: ” $objItem.Description

write-host “SMBIOSBIOSVersion: ” $objItem.SMBIOSBIOSVersion

write-host "SerialNumber: " $objItem.SerialNumber

write-host "Product Number: " $objItem.ProductNumber

write-host "Version: " $objItem.Version}

Write-host

Write-Host

Write-Host

Write-Host “End of Report for $strComputer”

Write-Host “======================================"

Write-Host 

Write-Host

Get-wmiobject -class win32_bios | select-object ComputerName,Description,SMBIOSBIOSVersion,SerialNumber,ProductNumber,Version | export-csv -Path C:\Users\%Username%\desktop\out.csv -noTypeInformation

} #End function calls.

It exports a file but it doesn't connect to the computer from the list and grabs that info and writes to the csv file. 

Viewing all articles
Browse latest Browse all 6937

Trending Articles