View Microsoft.PowerShell_profile.ps1
## Use PowerShell Engine Event (OnIdle) to Update the PowerShell
## Console Window's Title to have the current path and last command executed.
## For this to work Nicely add it to your PowerShell Profile.
## Subscribe to PowerShell.OnIdle Event
## Out to null to hide Register-EngineEvent output
$null = Register-EngineEvent PowerShell.OnIdle -Action {
## Get Last Command ran from history
$LastCommand = Get-History | Sort-Object -Property Id -Descending | Select-Object -First 1 -exp CommandLine
## Updated the console window's title to have the path and command.
View Invoke-URLInDefaultBrowser.ps1
function Invoke-URLInDefaultBrowser
Cmdlet to open a URL in the User's default browser.
Cmdlet to open a URL in the User's default browser.
Specify the URL to be Opened.
View AutomaticJobCleanup.ps1
#Build Job Name to be unique
$JobName = "ExampleJob"
$JobNameCount = (get-job | Where-Object Name -like $JobName*).Count
$JobName = "$($JobName)_$($JobNameCount)"
#Define and Start job
$Job = Start-Job -Name $JobName -ScriptBlock { Start-Sleep 60 }
#Create Event to clean up job after complete
Register-ObjectEvent -InputObject $Job -EventName "StateChanged" -Action {
View ToastNotification_Windows10.ps1
$ErrorActionPreference = "Stop"
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString()
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
#Convert to .NET type for XML manipuration
$toastXml = [xml] $template.GetXml()
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null