Skip to content

Instantly share code, notes, and snippets.

@SimonWahlin
SimonWahlin / Start-TypedDemo.ps1
Last active July 4, 2019 19:53
Start-TypedDemo
# Script originally from: https://jdhitsolutions.com/blog/powershell/4445/simulating-a-powershell-demo/
# Slightly modified by @SimonWahlin
Function Start-TypedDemo {
<#
.SYNOPSIS
Simulate a PowerShell session
.DESCRIPTION
This command simulates an interactive PowerShell session. It will process a text file of PowerShell commands. The function will insert your prompt and "type" out each command when you press any key. At the end of the typed command or whenever a pipe character is inserted, the script will pause. Press Enter or any key to continue.
If it is the end of the command pressing Enter will execute the command. Use the -NoExecute parameter to run through the demo without executing any commands. Commented lines will be skipped. Press 'q' or ESC at any pause to quit the demo.
@SimonWahlin
SimonWahlin / profile.ps1
Last active January 26, 2023 14:41
PowerShell Profile
#region BootstrapProfile
try {
Import-Module 'posh-git' -ErrorAction 'stop'
}
catch {}
if (
$host.Name -eq 'Visual Studio Code Host' -or
(Get-Process -Id $PID).Parent.ProcessName -like 'Code*'
) {
@SimonWahlin
SimonWahlin / demo.psm1
Created February 8, 2023 13:59
PowerShell Demo
# Save this file and import it using the command `Imort-Module '<path to file'`
$Script:Demo = @(
@'
$PSVersionTable
'@
@'
Get-Command *AzAccount*