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 Update-RegistryFile { | |
<# | |
.SYNOPSIS | |
Updates a registry file. | |
.DESCRIPTION | |
Line break and certain characters will not import from standard registry files (even if export works). | |
This function replaces any entry with line breaks with a hex value representing the string. | |
#> |
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-ArgumentCompleter { | |
<# | |
.SYNOPSIS | |
Get custom argument completers registered in the current session. | |
.DESCRIPTION | |
Get custom argument completers registered in the current session. | |
By default Get-ArgumentCompleter lists all of the completers registered in the session. | |
.EXAMPLE | |
Get-ArgumentCompleter |
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 Watch-WinEvent { | |
<# | |
.SYNOPSIS | |
Watch for events matching a query in the event log. | |
.DESCRIPTION | |
Watch for events matching a query in the event log. | |
#> |
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 Visibility : byte { | |
Default = 0 | |
Hide = 1 | |
Show = 2 | |
} | |
function Convert-CeaserCipher { | |
<# | |
.SYNOPSIS | |
Convert a string to and from a ceaser cipher (ROT-13) encoding. |
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
filter Write-String { | |
<# | |
.SYNOPSIS | |
Write a string representation of an object. | |
.DESCRIPTION | |
Write-String creates formatted string representations of an input object. | |
.INPUTS | |
System.Object | |
.EXAMPLE | |
Get-Process | Write-String |
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 New-DynamicParameter { | |
<# | |
.SYNOPSIS | |
Create a new dynamic parameter object for use with a dynamicparam block. | |
.DESCRIPTION | |
New-DynamicParameter allows simplified creation of runtime (dynamic) parameters. | |
.EXAMPLE | |
New-DynamicParameter Name -DefaultValue "Test" -ParameterType "String" -Mandatory -ValidateSet "Test", "Live" | |
.EXAMPLE | |
New-DynamicParameter Name -ValueFromPipelineByPropertyName |
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-InstalledSoftware { | |
<# | |
.SYNOPSIS | |
Get all installed from the Uninstall keys in the registry. | |
.DESCRIPTION | |
Read a list of installed software from each Uninstall key. | |
This function provides an alternative to using Win32_Product. | |
.EXAMPLE | |
Get-InstalledSoftware |
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-CommandSource { | |
param ( | |
[Parameter(Mandatory)] | |
[String]$Name | |
) | |
try { | |
$commandInfo = Get-Command $Name | |
if ($commandInfo -is [System.Management.Automation.AliasInfo]) { | |
$commandInfo = $commandInfo.ResolvedCommand |
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
using namespace System.Net.Sockets; using namespace System.IO | |
function Watch-StarWars { | |
[CmdletBinding()] | |
param ( ) | |
try { | |
$tcpClient = [TcpClient]::new() | |
$tcpClient.Connect('towel.blinkenlights.nl', 23) |