Skip to content

Instantly share code, notes, and snippets.

@Keithlr2
Keithlr2 / 2015-12-ScriptingGamesPuzzle.ps1
Created December 29, 2015 23:17
2015-12-ScriptingGamesPuzzle
<#
.SYNOPSIS
Scripting games puzzle for December 2015
.DESCRIPTION
ALL REQUIREMENTS
1. Split $list into a collection of entries, as you typed them, and sort the results by length. As a bonus, see if you can sort the length without the number.
2. Turn each line into a custom object with a properties for Count and Item.
3. Using your custom objects, what is the total number of all bird-related items?
4. What is the total count of all items?
5. Using PowerShell what is the total number of cumulative gifts?
@Keithlr2
Keithlr2 / gist:21bfa0b44876d0ee6512
Created November 13, 2015 00:43
2015.11-ScriptingGamesPuzzle-Updated
param(
[parameter(Mandatory=$True)]
[string]$VMNameStr
)
$VMNames = ($VMNameStr.split(",")).Trim()|where-object {$_ -ne ""}
$VMNames | Foreach-object -Begin {$i = 0} -Process {set-variable -Name ("vmname" + $i) -value $_ ; $i++}
$VMNames
# Get-Variable -Include V* -Exclude "VerbosePreference"