Skip to content

Instantly share code, notes, and snippets.

@EngineeringDon
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EngineeringDon/8bc8eac35fce85092ddf to your computer and use it in GitHub Desktop.
Save EngineeringDon/8bc8eac35fce85092ddf to your computer and use it in GitHub Desktop.
EngineeringDon - 2015-July Scripting Games Puzzle
## Title: 2015 - July Scripting Games
##
## Description:
## http://powershell.org/wp/2015/07/04/2015-july-scripting-games-puzzle/
##
gcim Win32_OperatingSystem -co ((read-Host "Target Computers").Split(',') | ? {if($_ -eq "$null"){Write-Error "Need at least one Computer Name to Target";break}else{$_}})|ft PSComputerName,ServicePackMajorVersion,Version,@{l="BIOSSerial";e={(gcim Win32_BIOS -co $_.PSComputerName).SerialNumber}} -au
## EXAMPLE OUTPUT:
## Target Computers: localhost,localhost
##
## PSComputerName ServicePackMajorVersion Version BIOSSerial
## -------------- ----------------------- ------- ----------
## localhost 1 6.1.7601 1S21VY1
## localhost 1 6.1.7601 1S21VY1
## SCRIPT/LONG FORMAT:
##
## Get-CimInstance `
## -ClassName Win32_OperatingSystem `
## -ComputerName ( (Read-Host -Prompt "Enter Target Computer Names").split(',') |
## Where-Object {
## if ($PSItem -eq "$null") {
## Write-Error "Need at least one Computer Name to Target"; break
## }
## else {
## $PSItem
## }
## }
## ) |
## Format-Table `
## -Property PSComputerName,`
## ServicePackMajorVersion,`
## Version,`
## @{
## Label = "BIOSSerial";
## Expression = { (Get-CimInstance -ClassName Win32_BIOS -ComputerName $PSItem.PSComputerName).SerialNumber }
## }`
## -AutoSize
## Author: Don Walker
## Date: 07/12/2015
## Version: 0.0
## Notes: Initial Build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment