This file contains hidden or 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 Compare-WeekDays { | |
# Return days between weekdays | |
param ( | |
[Parameter(Mandatory=$true)] | |
[System.DayOfWeek]$Minuend, | |
[Parameter(Mandatory=$true)] | |
[System.DayOfWeek]$Subtrahend | |
) | |
# In case they change how many days are in a week :) | |
$DaysInWeek = [System.Enum]::GetNames('System.DayOfWeek').Count |
This file contains hidden or 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 Export-Registry { | |
Param ( | |
$ComputerName = "iis", | |
$Key = "hklm\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", | |
$LocalPath = "." | |
) | |
$DateText = (Get-Date -Format s) -replace ':', '-' | |
$FileName = "$DateText-$ComputerName.reg" |
This file contains hidden or 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
# PowerShell 5 and above | |
Enum MyConColor { | |
Black | |
Red | |
Green | |
Yellow | |
Blue | |
Magenta | |
Cyan | |
White |
This file contains hidden or 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
$Services = @( | |
"netlogon" | |
"spooler" | |
) | |
$Computers = @( | |
"." | |
"iis" | |
) | |
Get-Service -Name $Services -ComputerName $Computers -ErrorAction SilentlyContinue | |
This file contains hidden or 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
$test = 5, 4, 5, $null, 4, 8, 3, 5, 4 | |
$chartdatasource = $test | ForEach-Object { | |
Write-Output @{ Value = $PSItem } | |
} | |
# load the appropriate assemblies | |
[void][Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”) | |
[void][Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms.DataVisualization”) |
This file contains hidden or 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
<# | |
.SYNOPSIS | |
Creates random password string of length 1 to 100. | |
.DESCRIPTION | |
Creates random password with ability to choose what characters are in the string and the length, the symbols can be specificlly defined. | |
.EXAMPLE | |
New-RandomPassword -Length 8 -Lowercase | |
In this example, a random string that consists of 8 lowercase charcters will be returned. | |
.EXAMPLE | |
New-RandomPassword -Length 15 -Lowercase -Uppercase -Numbers -Symbols |
This file contains hidden or 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
1 LOMEM: 14080 | |
5 GOSUB 10000: GOSUB 11000: GOSUB 16000: GOTO 135 | |
10 REM <<< LEMONADE STAND >>> | |
15 REM | |
20 REM FROM AN ORIGINAL PROGRAM | |
30 REM BY BOB JAMISON, OF THE | |
40 REM MINNESOTA EDUCATIONAL | |
50 REM COMPUTING CONSORTIUM | |
60 REM * * * | |
70 REM MODIFIED FOR THE APPLE |
This file contains hidden or 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
<# | |
.Synopsis | |
Roll dice | |
.DESCRIPTION | |
Given a role-playing description of dice, e.g. "2d6", return an object | |
with the randomly rolled results | |
.EXAMPLE | |
Invoke-Dice 2d6 | |
.EXAMPLE | |
Invoke-Dice 2d6 -Bonus 3 |
This file contains hidden or 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
############################### | |
### Font and size info here ### | |
############################### | |
9..32 | ForEach-Object { | |
$Size = $PSItem | |
"Lucida Console", "Consolas" | ForEach-Object { | |
$psISE.Options.FontSize = $Size | |
$psISE.Options.FontName = $PSItem | |
$psISE.CurrentPowerShellTab.Files.SelectedFile.Editor.SetCaretPosition(2,1) |
This file contains hidden or 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
<# | |
.Synopsis | |
Generates file name and front matter scaffolding for a Jekyll post. | |
.DESCRIPTION | |
Given a post title string, creates file name and front matter for a Jekyll | |
post using the current date and time. Optionally creates the file in the | |
.\_posts directory or designated -Path\_posts or -PostsPath. | |
.EXAMPLE | |
New-JekyllPost "Title of the new post" | |
.EXAMPLE |
NewerOlder