Skip to content

Commit

Permalink
+ Added code to catch empty serial numbers
Browse files Browse the repository at this point in the history
+ Added versioning
  • Loading branch information
bartenbach committed Feb 18, 2017
1 parent 2360051 commit 61b5b18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PC-Information.ps1.un~
PC-Information.ps1~
..gitignore.un~
.gitignore~
10 changes: 7 additions & 3 deletions PC-Information.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
$version = '0.0.1'

function Handle-NoConnection {
$FriendlyName = $Computer.split(":")[1]
Expand All @@ -26,7 +27,7 @@ function Handle-InvalidOperatingSystem {
}

function Initialize {
Write-Host "PC Information - Jonathon Ament, Blake Bartenbach - Copyright 2016" -foregroundcolor "DarkGray"
Write-Host "PC Information $version - Jonathon Ament, Blake Bartenbach - Copyright 2016" -foregroundcolor "DarkGray"
$OS = Get-WmiObject -Computer $env:computername -Class Win32_OperatingSystem
if ($OS.caption -notlike "*Windows*") {
Handle-InvalidOperatingSystem
Expand Down Expand Up @@ -113,7 +114,10 @@ function Display-Result {
Format-Result Cyan " System Name " Cyan $system
Format-Result Cyan " Manufacturer " Cyan $manufacturer
Format-Result Cyan " Model " Cyan $model
Format-Result Cyan " Serial Number " Cyan $serialnumber
# serial number may not be available
if (![string]$serialnumber.equals("System Serial Number")) {
Format-Result Cyan " Serial Number " Cyan $serialnumber
}
Format-Result Cyan " BIOS Version " Cyan $biosversion
Write-Host ""
Write-Host "Specifications" -ForegroundColor "Magenta"
Expand All @@ -135,4 +139,4 @@ function Display-Result {
Write-Host ""
}

Main
Main

0 comments on commit 61b5b18

Please sign in to comment.