Last active
August 29, 2015 14:24
-
-
Save jimmehc/8d450a3792ce5b5141ef to your computer and use it in GitHub Desktop.
PowerShell Scripting Games July 2015
This file contains 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}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment