Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
prompt
function Prompt
{
Write-Host "[" -NoNewline
Write-Host (Get-Date -Format "HH:mm:ss") -ForegroundColor Gray -NoNewline
try
{
$history = Get-History -ErrorAction Ignore
if ($history)
{
Write-Host "][" -NoNewline
if (([System.Management.Automation.PSTypeName]'Sqlcollaborative.Dbatools.Utility.DbaTimeSpanPretty').Type)
{
Write-Host ([Sqlcollaborative.Dbatools.Utility.DbaTimeSpanPretty]($history[-1].EndExecutionTime - $history[-1].StartExecutionTime)) -ForegroundColor Gray -NoNewline
}
else
{
Write-Host ($history[-1].EndExecutionTime - $history[-1].StartExecutionTime) -ForegroundColor Gray -NoNewline
}
}
}
catch { }
Write-Host "] $($executionContext.SessionState.Path.CurrentLocation.ProviderPath)" -NoNewline
"> "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.