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 Get-ISEMRU { | |
[cmdletbinding()] | |
Param() | |
<# | |
Path will be something like: | |
C:\Users\Jeff\AppData\Local\microsoft_corporation\powershell_ise.exe_StrongName_lw2v2vm3wmtzzpebq33gybmeoxukb04w | |
#> | |
$ISEPath = "$env:localappdata\microsoft_corporation\powershell_ise*\3.0.0.0" |
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
Enum BookCategory { | |
GeneralFiction | |
Horror | |
Romance | |
Literary | |
Mystery | |
Thriller | |
ScienceFiction | |
NonFiction |
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
#requires -version 4.0 | |
#requires -module Microsoft.WSMan.Management | |
<# | |
This is a copy of: | |
CommandType Name Version Source | |
----------- ---- ------- ------ | |
Cmdlet Test-WSMan 3.0.0.0 Microsoft.WSMan.Management |
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
#requires -version 5.0 | |
Function Test-Me { | |
[cmdletbinding()] | |
Param() | |
Write-Information "Starting $($MyInvocation.MyCommand) " -Tags Process | |
Write-Information "PSVersion = $($PSVersionTable.PSVersion)" -Tags Meta | |
Write-Information "OS = $((Get-CimInstance Win32_operatingsystem).Caption)" -Tags Meta |
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
#Requires -version 4.0 | |
<# | |
This is a script but it supports -Whatif and accepts parameters. | |
#> | |
[cmdletbinding(SupportsShouldProcess)] | |
Param ( | |
[Parameter(Position = 0, HelpMessage = "Enter the path where you want to save the downloads")] |
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
#you will need a text file of words like this list from https://github.com/dwyl/english-words | |
Function Get-Anagram { | |
[cmdletbinding()] | |
Param( | |
[Parameter(Position = 0, Mandatory)] | |
[ValidateNotNullorEmpty()] | |
[Alias("word")] | |
[string]$Text, |
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
#generate a fictious name that might exist in the Star Wars universe. | |
[cmdletbinding()] | |
Param( | |
[Parameter(Mandatory,HelpMessage="Enter your first name. It must be at least 2 characters")] | |
[ValidateNotNullOrEmpty()] | |
[ValidateScript({$_.length -ge 2})] | |
[String]$Name, | |
[Parameter(Mandatory,HelpMessage="Enter your Mother's first name. It must be at least 2 characters")] | |
[ValidateNotNullOrEmpty()] |
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
#this prompt counts down to the first day of Hanukkah 2017 | |
<# | |
It appears that some of the special characters I was using aren't supported in Windows 10 unless you are using Raster fonts. | |
[CHAR]14 is supposed to be a musical note and [CHAR]15 is like a snowflake. | |
You can select any other character you want, or none at all. | |
#> | |
Function Prompt { | |
#get current year | |
$year = (Get-Date).year |
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
#Insert a ToDo comment in an ISE script file | |
$action = { | |
$psise.CurrentFile.Editor.InsertText("# [$((Get-Date).ToShortDateString())] ToDo: ") | |
#jump cursor to the end | |
$psise.CurrentFile.editor.SetCaretPosition($psise.CurrentFile.Editor.CaretLine,$psise.CurrentFile.Editor.CaretColumn) | |
} | |
#add the action to the Add-Ons menu | |
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("ToDo",$Action,"Alt+2" ) | Out-Null |
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
#requires -version 4.0 | |
Function Out-More { | |
<# | |
.Synopsis | |
Send "pages" of objects to the pipeline. | |
.Description | |
This function is designed to display groups or "pages" of objects to the PowerShell pipeline. It is modeled after the legacy More.com command line utility. | |
By default the command will write out objects out to the pipeline in groups of 50. You will be prompted after each grouping. Pressing M or Enter will get the next group. Pressing A will stop paging and display all of the remaining objects. Pressing N will display the next object. Press Q to stop writing anything else to the pipeline. |