Skip to content

Instantly share code, notes, and snippets.

View santisq's full-sized avatar

Santiago Squarzon santisq

View GitHub Profile
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
santisq / Get-FileEncoding.ps1
Created November 1, 2022 14:18 — forked from indented-automation/Get-FileEncoding.ps1
Signature-based encoding detection
using namespace System.Collections.Generic; using namespace System.Linq
function Get-FileEncoding {
Attempt to determine a file type based on a BOM or file header.
This script attempts to determine file types based on a byte sequence at the beginning of the file.
If an identifiable byte sequence is not present the file type cannot be determined using this method.
santisq / Clean-File-Demo.ps1
Created June 15, 2022 16:04 — forked from indented-automation/Clean-File-Demo.ps1
Removes trailing null data from the end of a file
$Path = 'c:\temp\test.long'
$content = [Byte[]]::new(50MB)
[Byte[]][Char[]]'Hello world',
function Test-RpcPort {
Enumerates and tests connectivity to the RPC ports on the target server.
Enumerates and tests connectivity to the RPC ports on the target server.
Rebuilt from
santisq / Time-Command.ps1
Created May 25, 2022 21:22 — forked from mklement0/Time-Command.ps1
PowerShell function that times the execution of one or more commands, averaged over a specifiable number of runs.
Prerequisites: PowerShell v5.1 and above (verified; may also work in earlier versions)
License: MIT
Author: Michael Klement <>
irm | iex

A small collection specialised scripts for Active Directory.


  • Compare-ADMemberOf
  • Get-ADSystemInfo
  • Get-GroupMemberTree
  • Get-LdapObject
  • Get-MemberOfTree
  • Test-LdapSslConnection
santisq / ModuleFast.ps1
Created January 13, 2022 04:13 — forked from JustinGrote/ModuleFast.ps1
A high performance Powershell Gallery Module Installer
#requires -version 5
High Performance Powershell Module Installation
This is a proof of concept for using the Powershell Gallery OData API and HTTPClient to parallel install packages
It is also a demonstration of using async tasks in powershell appropriately. Who says powershell can't be fast?
This drastically reduces the bandwidth/load against Powershell Gallery by only requesting the required data
It also handles dependencies (via Nuget), checks for existing packages, and caches already downloaded packages