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 Send-Syslog { | |
param ( | |
[Parameter(Mandatory, ValueFromPipeline)] | |
[String]$Message, | |
[String]$LogLevel = 'Information', | |
[Parameter(Mandatory)] | |
[IPAddress]$IPAddress, |
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 ConvertTo-TableFormat { | |
<# | |
.SYNOPSIS | |
Rebuild an object based on the Format Data for the object. | |
.DESCRIPTION | |
Allows an object to be rebuilt based on the view data for the object. Uses Select-Object to create a new PSCustomObject. | |
#> | |
[CmdletBinding()] | |
param ( |
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.Collections.Generic; using namespace System.Text | |
Add-Type -TypeDefinition ' | |
using System; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
public class WindowTools | |
{ | |
public delegate bool EnumWindowsProc(IntPtr hWnd, int lParam); |
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 Measure-ChildItem { | |
<# | |
.SYNOPSIS | |
Recursively measures the size of a directory. | |
.DESCRIPTION | |
Recursively measures the size of a directory. | |
Measure-ChildItem uses win32 functions, returning a minimal amount of information to gain speed. Once started, the operation cannot be interrupted by using Control and C. The more items present in a directory structure the longer this command will take. | |
This command supports paths longer than 260 characters. |
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) |
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 ConvertTo-DataTable { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline)] | |
[Object]$InputObject | |
) | |
begin { | |
$dataTable = [System.Data.DataTable]::new() | |
} |
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 NameType { | |
DistinguishedName = 1 | |
CanonicalName | |
NT4 | |
DisplayName | |
DomainSimple | |
EnterpriseSimple | |
Guid | |
Unknown | |
UserPrincipalName |
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 ConvertTo-NormalizedString { | |
<# | |
.SYNOPSIS | |
Attempts to replace diacritics within a the input string. | |
.DESCRIPTION | |
Uses String.Normalize to attempt to replace diacritic characters within a string. | |
#> | |
[CmdletBinding()] | |
param ( |