I am trying to build a function that retrieves information from the bios using get-WmiObject. My issue is that I have a script that I have to pull information from computers on my network. Right now my script is ugly and I am trying to clean it up. I am very new to powershell so I there might be a better way to do what I am trying to do. Here is a snippet of my script:
I would like to make a function out of this snippet but there are some computers that hide their serial numbers not in Win32_bios but in Win32_baseboard (Intel NUC’s). Is there a better way then to return four separate variables? I would like to just return the object and get what I need by typing $bios.serialnumber, etc… Right now I don’t think that there is a good way to do this but I am open for suggestions. Thank you very much!