36 How to check BIOS Version of the remote systems of Win 10/server 2012 and above?
In the below PowerShell script:-
- Name and save the script as “Get-BIOSVersionInfo.PS1”.
- Create a temp folder into Drive C.
- Create a text file into the temp folder with the name called “computers.txt”.
- Mention the computer name one in each row and save the text file.
- The output CSV file name called “OS_BIOS_Details” will be saved to the temp folder.
In case of any hurdle, please Contact Us
del C:\Temp\OS_Details.csv -ErrorAction SilentlyContinue
function Get-HostToIP($hostname) {
$result = [system.Net.Dns]::GetHostByName($hostname)
$result.AddressList | ForEach-Object {$_.IPAddressToString }
}
Get-Content C:\Temp\computers.txt | ForEach-Object{
$os_name = (Get-ciminstance Win32_OperatingSystem -ComputerName $_ ).Caption
if(!$os_name){
Write-Progress -Activity "Collecting Information of" -Status $_ -PercentComplete 35
$os_name = "The machine is unavailable"
$os_version = "The machine is unavailable"
$os_lastboot = "The machine is unavailable"
$IP_Address = "The machine is unavailable"
$MajorBIOS = "The machine is unavailable"
$MinorBIOS = "The machine is unavailable"
$Display = "The machine is unavailable"
}
else{
$os_version = (Get-ciminstance Win32_OperatingSystem -ComputerName $_).Version
$os_lastboot = (Get-CimInstance Win32_OperatingSystem -ComputerName $_ ).LastBootUpTime
$IP_Address = (Get-HostToIP($_)) + ($_).HostName
$MajorBIOS = (Get-WmiObject -Class Win32_BIOS -ComputerName $_).smbiosbiosversion
$MinorBIOS = (Get-WmiObject -Class Win32_BIOS -ComputerName $_).SmbiosMinorVersion
# (Get-WMIObject Win32_OperatingSystem -ComputerName $_).LastBootUpTime
$wmi = gwmi Win32_OperatingSystem -computer $_ -ErrorAction SilentlyContinue
$LBTime = $wmi.ConvertToDateTime($wmi.Lastbootuptime)
[TimeSpan]$uptime = New-TimeSpan $LBTime $(get-date)
$Display = "$($uptime.days) Days $($uptime.hours) Hrs $($uptime.minutes) Mins $($uptime.seconds) Secs"
Write-Progress -Activity "Collecting Information of" -Status $_ -PercentComplete 100
}
New-Object -TypeName PSObject -Property @{
ComputerName = $_
OSName = $os_name
OSVersion = $os_version
LastBootUpTime = $os_lastboot
IPAddress = $IP_Address
MajorBIOS = $MajorBIOS
MinorBIOS = $MinorBIOS
UPTime = $Display
}} | Select ComputerName,IPAddress,OSName,OSVersion,LastBootUpTime,MajorBIOS,MinorBIOS,UPTime|
#ConvertTo-Html|
#Out-File C:\temp\ij\server_OS_details\report.html | Format-Table -AutoSize
#invoke-item C:\temp\ij\server_OS_details\report.html
#Out-GridView
export-csv -Path C:\Temp\IJ\server_OS_details\OS_Details.csv -NoTypeInformation -Append