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
if (-not (Test-IsAdministrator)) | |
{ | |
Write-Host -ForegroundColor Magenta 'Not an Admin :(' | |
Start-Process -Verb runAs -FilePath (Get-Process -Id $pid).Path -ArgumentList "-File $PSScriptRoot" -WindowStyle Hidden | |
} | |
Write-Host -ForegroundColor Magenta 'Admin :)' |
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
# Tray Icon requires Assemblies | |
Add-Type -AssemblyName System.Drawing | |
Add-Type -AssemblyName System.Windows.Forms | |
$tipTimeout = New-TimeSpan -Seconds 10 | |
$trayIcon = [System.Windows.Forms.NotifyIcon]::new() | |
$trayIcon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon((Get-Process -Id $PID).Path) | |
$trayIcon.Text = "It Does things"; | |
$trayIcon.Visible = $true; | |
$trayIcon.BalloonTipTitle = "Hi $env:USERNAME!"; |
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-GitDefaultBranch | |
{ | |
[CmdletBinding()] | |
param | |
( | |
# Base path where you store all your repos... | |
[Parameter(Mandatory)] | |
[string] | |
$Path, |
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
$taskScript = { | |
# Do your stuff, start the service, ... | |
Start-Service -Name TheCrashingService | |
$triggers = @( | |
New-ScheduledTaskTrigger -Once -At (Get-Date).AddHours(12) | |
New-ScheduledTaskTrigger -AtLogOn -User 'someone' | |
) | |
$task = Get-ScheduledTask -TaskName YourScheduledTask |
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 Enable-AllTheRules | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory)] | |
[string] | |
$ResourceGroupName, | |
[Parameter(Mandatory)] |
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
Install-Module AutomatedLab.Recipe -AllowClobber -Force | |
# Inline definition and execution | |
LabRecipe MySuperLab { | |
DeployRole = 'Domain', 'SQL' | |
VmPrefix = 'LB' | |
} | Invoke-LabRecipe | |
# Store a lab for later use | |
New-LabRecipe -Name MySuperLab -DeployRole DscPull,CI_CD |
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
<# | |
Both files for my tests simply contained | |
{ bla = 'value } | |
and | |
{ bla = 'UserDefinedValue' } | |
#> | |
$d = @" | |
ResolutionPrecedence: |
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-IcsEvent | |
{ | |
[OutputType([System.IO.FileInfo[]])] | |
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] | |
param | |
( | |
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
[datetime[]] | |
$StartDate, |
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
# Install module for Toast Notifications | |
if (-not (Get-Module BurntToast -ListAvailable)) | |
{ | |
Install-Module BurntToast -Scope CurrentUser -Force | |
} | |
# Create path for state file | |
if (-not (Test-Path $env:APPDATA\Fuppes)) | |
{ | |
[void] (New-Item -ItemType Directory -Path $env:APPDATA\Fuppes) |
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
# Install the module | |
Install-Module AutomatedLab.Ships | |
# Either Mount the drive yourself | |
Import-Module AutomatedLab.Ships | |
New-PSDrive -PSProvider SHiPS -Name Labs -Root "AutomatedLab.Ships#LabHost" | |
# Or simply import AutomatedLab to get one mapped for you | |
Import-Module AutomatedLab |
NewerOlder