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 Prompt | |
{ | |
#Based off https://dbatools.io/prompt/ - but doesn't show the current time. | |
try | |
{ | |
$history = Get-History -ErrorAction Ignore | |
if ($history) | |
{ | |
Write-Host "[" -NoNewline | |
if (([System.Management.Automation.PSTypeName]'Sqlcollaborative.Dbatools.Utility.DbaTimeSpanPretty').Type) |
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 Start-CollectionMigration { | |
Param($Collection) | |
Start-Sleep -Milliseconds 250 | |
} | |
Function Test-CollectionMigration { | |
Param($Collection) | |
$Random = Get-Random -Minimum 1 -Maximum 10 | |
if($Random -eq 2){ | |
return $false |
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; | |
using System.Security.Principal; | |
using System.Runtime.InteropServices; | |
namespace ECGCAT | |
{ | |
public class Kernel32 | |
{ | |
[DllImport("Kernel32.dll", SetLastError = true)] |
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 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) | |
$SyncTable.RunspacePool.Open() | |
for ($i = 0; $i -lt $Threads; $i++) { |
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-EphingWPFCode { | |
<# | |
.SYNOPSIS | |
Writes the code for a new WPF window in the ISE | |
.DESCRIPTION | |
The $xaml varialbe needs to be loaded in the session before this is run | |
Make sure to highlight the $xaml varialbe and run it! | |
.EXAMPLE |
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 Mount-EphingDrive { | |
Param ($Path) | |
$DriveLetter="" | |
$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] |