This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Type the remote computer name after the scriptblock to target something other than localhost | |
# ft purely because "ft" is 4 characters shorter than "select" | |
&{param($x="localhost") gwmi Win32_operatingsystem -cn $x | Add-Member @{BiosSerial=(gwmi Win32_BIOS -cn $x).SerialNumber} -pa|ft psc*,s*aj*,v*,bi*} | |
# This is a little shorter than that, but everyone else has done it this way | |
&{param($x="localhost") gwmi Win32_operatingsystem -cn $x | ft psc*,s*aj*,v*,@{n="BiosSerial";e={(gwmi Win32_BIOS -cn $x).SerialNumber}}} | |
# To support passing an array of multiple computer names | |
&{param($x="localhost") gwmi Win32_operatingsystem -cn $x | ft psc*,s*aj*,v*,@{n="BiosSerial";e={(gwmi Win32_BIOS -cn $_.PSComputerName).SerialNumber}}} |