Skip to content

Instantly share code, notes, and snippets.

Chris Dent indented-automation

Block or report user

Report or block indented-automation

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Get-ADAttributeAlias.ps1
function Get-ADAttributeAlias {
<#
.SYNOPSIS
Gets the names of the aliased attributes from the ActiveDirectory module.
.DESCRIPTION
Users reflection to discover the names of the attribute aliases available to filters.
View Convert-ADFilter.ps1
using module ActiveDirectory
using namespace System.Reflection
function Convert-ADFilter {
<#
.SYNOPSIS
Converts PowerShell-style filters used by the AD module into LDAP filters.
.DESCRIPTION
Convert-ADFilter uses the QueryParser from the AD module to convert PowerShell-style filters into LDAP
@indented-automation
indented-automation / Export-EventLog.ps1
Created Nov 29, 2019
Export an event log to an evtx file.
View Export-EventLog.ps1
function Export-EventLog {
<#
.SYNOPSIS
Export an event log to a saved event log file.
.DESCRIPTION
Export an event log, and it's messages, to a named event log file.
.EXAMPLE
Get-WinEvent -ListLog Application | Export-EventLog
View Invoke-NativeCommand.ps1
function Invoke-NativeCommand {
<#
.SYNOPSIS
Invoke a native command (.exe) as a new process.
.DESCRIPTION
Invoke-NativeCommand executes an arbitrary executable as a new process. Both the standard
and error output streams are redirected.
Error out is written as a single non-terminating error. ErrorAction can be used to raise
View Update-RegistryFile.ps1
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.
#>
@indented-automation
indented-automation / Send-Syslog.ps1
Created Sep 17, 2019
Send a message to a SysLog instance
View Send-Syslog.ps1
function Send-Syslog {
param (
[Parameter(Mandatory, ValueFromPipeline)]
[String]$Message,
[String]$LogLevel = 'Information',
[Parameter(Mandatory)]
[IPAddress]$IPAddress,
View ConvertTo-TableFormat.ps1
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 (
View WindowTools.ps1
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);
View Measure-ChildItem.ps1
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.
View Watch-StarWars.ps1
using namespace System.Net.Sockets; using namespace System.IO
function Watch-StarWars {
[CmdletBinding()]
param ( )
try {
$tcpClient = [TcpClient]::new()
$tcpClient.Connect('towel.blinkenlights.nl', 23)
You can’t perform that action at this time.