![]() ![]() The following would work in 2.0 PowerShell if you have that New-Object psobject -Property = $bios._SERVER The Select-Object statements on both lines are not required but since we only need that data it made sense. Output the results from both in a single object. $computerSystem = Get-WmiObject win32_computersystem -ComputerName $c | Select-Object = $bios._SERVERĬapture the output of both WMI calls into variables. If you have PowerShell 3.0 this should work in place of your Try block $bios = Get-WmiObject win32_bios -ComputerName $c | Select-Object _SERVER, BIOSVersion, SerialNumber What you need to do is create a single object with data from both queries. I imagine it is getting discarded due to a mismatch. However the output you are using the second time would not match the object of the previous one. I remember reading about functions returning all output. | convertTo-Html | out-string ) -BodyAsHtml Subject "BIOS Version Report" -body (getthebios | Sort-Object 'BIOS version' "the following servers could not be reached:" ![]() Get-WmiObject win32_computersystem -ComputerName $c | Get-WmiObject win32_bios -ComputerName $c | $badcomp = Get-ADComputer -Filter 'name -like "*"' | select -ExpandProperty Name It always just runs whichever commandlet is first and then goes to the next computer in the list. Like I said, them both work, just not together. So, I was going to grab it from win32_computersystem. I want to add the model number, but that property is not in win32_bios (at least that I know of). ![]() It produces an email report with all computers in domain that looks something like this:Įxserver DELL - 1 Phoenix ROM BIOS PLUS Version 1.10 2.7.0 3ZTVDC1 The both work as expected if they are in there without the other, but not together. My question concerns the Get-WmiObject win32_bios and Get-WmiObject win32_computersystem commandlets in the Try Block. I am a complete noob with regards to programming logic and some help would be greatly appreciated. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |