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 {
Gets the names of the aliased attributes from the ActiveDirectory module.
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 {
Converts PowerShell-style filters used by the AD module into LDAP filters.
Convert-ADFilter uses the QueryParser from the AD module to convert PowerShell-style filters into LDAP
indented-automation / Export-EventLog.ps1
Created Nov 29, 2019
Export an event log to an evtx file.
View Export-EventLog.ps1
function Export-EventLog {
Export an event log to a saved event log file.
Export an event log, and it's messages, to a named event log file.
Get-WinEvent -ListLog Application | Export-EventLog
View Invoke-NativeCommand.ps1
function Invoke-NativeCommand {
Invoke a native command (.exe) as a new process.
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 {
Updates a registry file.
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 / 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]$LogLevel = 'Information',
View ConvertTo-TableFormat.ps1
function ConvertTo-TableFormat {
Rebuild an object based on the Format Data for the object.
Allows an object to be rebuilt based on the view data for the object. Uses Select-Object to create a new PSCustomObject.
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 {
Recursively measures the size of a directory.
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 {
param ( )
try {
$tcpClient = [TcpClient]::new()
$tcpClient.Connect('', 23)
You can’t perform that action at this time.