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-NumberRange | |
{ | |
[cmdletbinding()] | |
Param() | |
DynamicParam { | |
$Dictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary | |
$NewDynParam = @{ | |
Name = "Firstnumber" | |
Alias = "int" |
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
[cmdletbinding()] | |
Param( | |
[string]$ServiceName = "Bonjour Service" | |
) | |
$f = $MyInvocation.InvocationName | Split-Path -Leaf | |
Write-Verbose -Message "$f - START" | |
$cimService = Get-CimInstance -Query "Select * from win32_Service where Name='$ServiceName'" -ErrorAction SilentlyContinue |
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-SingleWeekDate | |
{ | |
<# | |
.Synopsis | |
Get all dates for a specific day of the week on year forward. Please give me a better function name!! | |
.DESCRIPTION | |
Long description which is very short | |
.EXAMPLE | |
Get-SingleWeekDate -DayOfWeek Monday |
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
$GetEventLog = @{ | |
After = Get-Date -Date "22.08.2016" | |
LogName = "System" | |
EntryType = "Information" | |
InstanceId = 6006 | |
} | |
$GetEventLog.Add("Before",$GetEventLog.After.Adddays(5)) |
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
$csvObjects = foreach($int in (0..10000)) | |
{ | |
$date = get-date | |
[pscustomobject]@{ | |
id = (10000+$int) | |
Msg = "this belongs to id $int" | |
Date = $date.AddDays(2000-$int) | |
Random = get-random | |
ticks = $date.Ticks | |
} |
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
$measureWhere = @() | |
foreach ($count in (0..10)) | |
{ | |
$id1 = $CollectionOfIDs | Get-Random | |
$id2 = $CollectionOfIDs | Get-Random | |
[gc]::Collect() | |
$measureWhere += Measure-Command -Expression { | |
$csvObjects.Where({$_.id -eq $id1 -or $_.id -eq $id2}) | |
} | |
} |
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
$csvHash = @{} | |
foreach($obj in $csvObjects) | |
{ | |
$csvHash[$obj.id] = $obj | |
} |
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
foreach($count in (0..10)) | |
{ | |
$id1 = $CollectionOfIDs | Get-Random | |
$id2 = $CollectionOfIDs | Get-Random | |
[gc]::Collect() | |
$measureHash += Measure-Command -Expression { | |
$csvHash[$id1,$id2] | |
} | |
} |
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
$Source = @” | |
using System; | |
namespace ArrayTest | |
{ | |
public static class ArrayStuff | |
{ | |
public static sample ForEach(System.Array _items, int[] Id) | |
{ | |
foreach (sample item in _items) |
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 Test-String | |
{ | |
param( | |
[parameter(Valuefrompipeline)] | |
[string]$InputObject | |
) | |
Begin | |
{} |