param ([string]$Text, [switch]$help) function GetHelp() { $HelpText = @" DESCRIPTION: NAME: Write-StickyNote.ps1 Writes Text to a StickyNote in WIndows 7 PARAMETERS: -Text Text to Write (Required) -help Display HelpText (Optional) SYNTAX: Write-StickyNote.ps1 -Text "Hello World" Writes Hello World to a StickyNote. Write-StickyNote.ps1 -help Displays the help topic for the script "@ $HelpText } function Write-StickyNote ([string]$Text) { if (gps | Where { $_.ProcessName -match "stikynot" }) { $StickyNote = $True } $Wscript = New-Object -Com Wscript.Shell [void]$Wscript.Run("stikynot.exe") start-sleep 1 if ($StickyNote -eq $True) { $Wscript.SendKeys("^n") } $Wscript.SendKeys($Text) } if ($help) { GetHelp } if ($Text) { Write-StickyNote $Text }