Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Dent indented-automation

View GitHub Profile
View Get-TaskStartDate.ps1
function Get-TaskStartDate {
<#
.SYNOPSIS
Get a start date from a string expression.
.DESCRIPTION
Finds the start date from a string expression.
.EXAMPLE
Get-TaskStartDate -Day '1st Monday'
View Test-RpcPort.ps1
function Test-RpcPort {
<#
.SYNOPSIS
Enumerates and tests connectivity to the RPC ports on the target server.
.DESCRIPTION
Enumerates and tests connectivity to the RPC ports on the target server.
Rebuilt from https://gallery.technet.microsoft.com/Test-RPC-Testing-RPC-4396fcda
#>
@indented-automation
indented-automation / Split-DistinguishedName.ps1
Last active Apr 5, 2020
Split an AD DN into different parts
View Split-DistinguishedName.ps1
function Split-DistinguishedName {
<#
.SYNOPSIS
Split a distinguishedName into named pieces.
.DESCRIPTION
Split a distinguishedName into Name, ParentDN, ParentName, and DomainComponent.
.EXAMPLE
Split-DistinguishedName 'OU=somewhere,DC=domain,DC=com'
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 (
You can’t perform that action at this time.