Skip to content

Instantly share code, notes, and snippets.

View PowerShellPrompt.ps1
function Prompt
#Based off - but doesn't show the current time.
$history = Get-History -ErrorAction Ignore
if ($history)
Write-Host "[" -NoNewline
if (([System.Management.Automation.PSTypeName]'Sqlcollaborative.Dbatools.Utility.DbaTimeSpanPretty').Type)
Ryan2065 / JobTracker.ps1
Last active Aug 10, 2020
Job Tracker using EFPosh PowerShell Module
View JobTracker.ps1
Function Start-CollectionMigration {
Start-Sleep -Milliseconds 250
Function Test-CollectionMigration {
$Random = Get-Random -Minimum 1 -Maximum 10
if($Random -eq 2){
return $false
Ryan2065 / WinPENanoDomainJoin.ps1
Created Oct 15, 2016
Nano domain join for use in SCCM task sequence!
View WinPENanoDomainJoin.ps1
$source = @'
using System;
using System.Security.Principal;
using System.Runtime.InteropServices;
namespace ECGCAT
public class Kernel32
[DllImport("Kernel32.dll", SetLastError = true)]
View Find Chess counts
Function Start-EphingThreads {
Param($ScriptBlock, $threads)
$SyncTable.ThreadsInProg = New-Object System.Collections.ArrayList
$Synctable.Runspaces = @{}
$SessionState = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault()
$SessionState.ApartmentState = "STA"
$SessionState.Variables.Add((New-Object -TypeName System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList 'SyncTable', $SyncTable, ""))
$SyncTable.RunspacePool = [RunspaceFactory]::CreateRunspacePool(1, $Threads, $SessionState, $Host)
for ($i = 0; $i -lt $Threads; $i++) {
Ryan2065 / New-EphingWPFCode.ps1
Last active Jan 18, 2016
Create WPF code from XAML
View New-EphingWPFCode.ps1
Function New-EphingWPFCode {
Writes the code for a new WPF window in the ISE
The $xaml varialbe needs to be loaded in the session before this is run
Make sure to highlight the $xaml varialbe and run it!
Ryan2065 / MountDrive.ps1
Created Dec 22, 2015
Mount ephing drive
View MountDrive.ps1
Function Mount-EphingDrive {
Param ($Path)
$MountedDrive = Mount-VHD -Path $Path -ErrorAction SilentlyContinue -PassThru
$Drives = (Get-Partition -DiskNumber $MountedDrive.DiskNumber).DriveLetter
If ($Drives.Count -gt 1) {
$LargestDrive = 0
For ($d = 0; $d -lt $Drives.Count; $d++) {
If (($Drives[$d] -ne [char]0) -and ((Get-Partition -DriveLetter $Drives[$d]).Size -gt $LargestDrive)) {
$DriveLetter = $Drives[$d]
You can’t perform that action at this time.