Skip to content

Instantly share code, notes, and snippets.

View BennettBenson's full-sized avatar

BennettBenson

View GitHub Profile
function Get-Uptime {
param ($snames = 'localhost')
$global:objects = @()
foreach ($sname in $snames) {
$object = New-Object –TypeName PSObject
$object | Add-Member –Type NoteProperty –Name Name –Value $sname
Try {
Test-Connection $sname -ErrorAction Stop | Out-Null
Try {
($osinfo = Get-CimInstance -ClassName win32_operatingsystem -ComputerName $sname -ErrorAction Stop) > $null
@BennettBenson
BennettBenson / TheTwelveDaysOfChristmas.ps1
Created January 5, 2016 00:46
Powershell.org Scripting Games 2015-12
$list = @"
1 Partridge in a pear tree
2 Turtle Doves
3 French Hens
4 Calling Birds
5 Golden Rings
6 Geese a laying
7 Swans a swimming
8 Maids a milking
9 Ladies dancing