Hi,
I’m looking to obtain the computer name, serial number and model from a range of IP addresses(50-254). So far I managed to get the computer names but I’m stuck with the other two. Also there is any way to know when I got an error (like access denied) from which IP it was. Right now when I got that error the script continue to run but I have no clue which PC fail.
I would take a look at the Win32_BIOS and Win32_Baseboard classes (Get-WMIObject). Both have a serial number field but I have had better luck with Win32_BIOS. Win32_Baseboard will often continue manufacturer and model number.
As far as determining which system an error came from you can try utilizing a try catch block. If you aren’t familiar with error handling, there is a free ebook on this very site (https://powershell.org/ebooks/).
Was that a typo? You’re putting your range in $oct4 but iterating over $octet4. Your iterator is $oct_a, but then you’re using $octb (undefined) as the last octet in the address.