Skip to content

Instantly share code, notes, and snippets.

$Data = 1..10 | ForEach-Object {
New-Object psobject -Property ([ordered]@{
Col1 = (Get-Random -Maximum 1000) + 1
Col2 = (Get-Random -Maximum 1000) + 1
Col3 = (Get-Random -Maximum 1000) + 1
Col4 = (Get-Random -Maximum 1000) + 1
Col5 = (Get-Random -Maximum 1000) + 1
})
}
param (
[Parameter(Mandatory=$True,Position=1)] $UserName,
$SharePath = "\\vsnhq1coap01mes\HomeMDB",
$CsvsToSearch = 1
)
# From CSV which lists Exchange server for each store,
# Create a lookup hash table
$StoreServer = @{}
Import-Csv -Path "store-server.csv" |
@midnightfreddie
midnightfreddie / Get-ChildItem-pipelining.ps1
Last active January 7, 2016 07:06
Testing concurrent processing of piped objects and comparing globbing versus match performance in reply to https://www.reddit.com/r/PowerShell/comments/35ua3n/running_into_massive_memory_consumption_using/cr89zuo
Function Get-Fibonacci {
# Function yoinked from http://blogs.technet.com/b/heyscriptingguy/archive/2010/03/07/hey-scripting-guy-march-7-2010.aspx
Param([int]$max)
For($i = $j = 1; $i -lt $max) {
$i
$i,$j = ($i + $j),$i
}
}
Function Get-Stats {