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
function parseNetstat { | |
param([object[]]$Lines) | |
if ($IsWindows) { | |
$skip = 4 | |
} else { | |
$skip = 3 | |
} | |
$Lines | Select-Object -Skip $skip | ForEach-Object { |
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
function New-DevOpsWorkItem { | |
param( | |
[Parameter(Mandatory=$true)] | |
[string]$title, | |
[Parameter(Mandatory=$true)] | |
[string]$description, | |
[int]$parentId, | |
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
class Cards { | |
[System.Collections.Generic.List[string]]$cards | |
[string]$name | |
Cards([string]$_name) { | |
$this.name = $_name | |
$this.cards = [System.Collections.Generic.List[string]]::new() | |
} | |
NewDeck() { |
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
param( | |
[string]$startURL, | |
[switch]$showall | |
) | |
$ErrorActionPreference = 'Stop' | |
$Error.Clear() | |
$lastError = $null | |
function getUrl { |
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
function Get-FileEncoding { | |
## Get-FileEncoding http://poshcode.org/2153 | |
<# | |
.SYNOPSIS | |
Gets the encoding of a file | |
.EXAMPLE |
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
function get-logonevents { | |
param( | |
[string]$computer=$env:computername, | |
[int]$days = 30 | |
) | |
$millisecperday = 24*60*60*1000 | |
$logonType = @{ | |
2='Interactive'; | |
3='Network'; | |
4='Batch'; |
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
#region AD Functions | |
#------------------------------------------------------- | |
function get-servers { | |
param([string[]]$names, | |
[string[]]$props = @('DNSHostName','OperatingSystem') | |
) | |
foreach ($name in $names) { | |
$c = $null | |
$hostname = ($name -split '\.')[0] |
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
function grab-url { | |
param( | |
[string[]]$filelist, | |
$headers, | |
[switch]$force | |
) | |
$curdir = (get-location).path | |
$wc = New-Object System.Net.WebClient | |
if ($headers) { | |
foreach ($key in $headers.keys) { |
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
function woot { | |
param([ValidateSet('accessories','computers','electronics','home','kids','sellout','shirt','sport','tools','wine','www', ignorecase=$true)] | |
[string]$site | |
) | |
$url = 'http://api.woot.com/1/sales/current.rss' | |
if ($site -ne "") { | |
$url = "http://api.woot.com/1/sales/current.rss/{0}.woot.com" -f $site | |
} | |
$woots = Invoke-RestMethod $url | |
foreach ($woot in $woots) { |
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
function update-sysinternals { | |
param([switch]$exclusions=$false) | |
$identity = [Security.Principal.WindowsIdentity]::GetCurrent() | |
$principal = [Security.Principal.WindowsPrincipal] $identity | |
if($principal.IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
$web = get-service webclient | |
if ($web.status -ne "Running") { "Starting webclient..."; start-service webclient } | |
$web = get-service webclient | |
while ($web.status -ne "Running") { sleep -sec 1 } | |
if ($exclusions) { |