Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Dent indented-automation

View GitHub Profile
View ActiveDirectory.md

A small collection specialised scripts for Active Directory.

Includes:

  • Compare-ADMemberOf
  • Get-ADSystemInfo
  • Get-GroupMemberTree
  • Get-LdapObject
  • Get-MemberOfTree
  • Test-LdapSslConnection
View Get-InstalledSoftware.ps1
function Get-InstalledSoftware {
<#
.SYNOPSIS
Get all installed from the Uninstall keys in the registry.
.DESCRIPTION
Read a list of installed software from each Uninstall key.
This function provides an alternative to using Win32_Product.
.EXAMPLE
Get-InstalledSoftware
@indented-automation
indented-automation / SystemTray.ps1
Created Jul 22, 2022
Functions to allow changes to the visibility of icons in the system tray.
View SystemTray.ps1
enum Visibility : byte {
Default = 0
Hide = 1
Show = 2
}
function Convert-CeaserCipher {
<#
.SYNOPSIS
Convert a string to and from a ceaser cipher (ROT-13) encoding.
@indented-automation
indented-automation / ADDns.ps1
Created Jul 21, 2022
This is a mess. Needs major refactoring.
View ADDns.ps1
##############################################################################################################################################################
# IANA #
##############################################################################################################################################################
#
# Address family
#
New-Enum -ModuleBuilder $IndentedDnsMB -Name "Indented.Dns.IanaAddressFamily" -Type "UInt16" -Members @{
IPv4 = 1; # IP version 4
View CreatePackage.ps1
# Chocolatey must be installed on all nodes which intend to use it
https://chocolatey.org/install#individual
# Make a folder called DhcpDaemon
New-Item DhcpDaemon -ItemType Directory
# Inside that folder, make a folder called Tools
# This will hold your installation files and an install script
New-Item DhcpDaemon\tools -ItemType Directory
# Make an install script
@indented-automation
indented-automation / New-Password.ps1
Last active Jul 19, 2022
PowerShell random password generator.
View New-Password.ps1
function New-Password {
<#
.SYNOPSIS
Generate a random password.
.DESCRIPTION
Generate a random password.
.NOTES
Change log:
27/11/2017 - faustonascimento - Swapped Get-Random for System.Random.
Swapped Sort-Object for Fisher-Yates shuffle.
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 Watch-WinEvent.ps1
function Watch-WinEvent {
<#
.SYNOPSIS
Watch for events matching a query in the event log.
.DESCRIPTION
Watch for events matching a query in the event log.
#>
@indented-automation
indented-automation / Get-DhcpClientOption.ps1
Created Jul 12, 2022
A partial parser for DHCP options in Windows
View Get-DhcpClientOption.ps1
function Get-DhcpClientOption {
[CmdletBinding()]
param ( )
$adapters = Get-CimInstance Win32_NetworkAdapterConfiguration -Filter 'IPEnabled=TRUE AND DhcpEnabled=TRUE'
foreach ($adapter in $adapters) {
$params = @{
LiteralPath = Join-Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces' -ChildPath $adapter.SettingID
Name = 'DhcpInterfaceOptions'
}
View Get-Manufacturer.ps1
function Update-ManufacturerList {
<#
.SYNOPSIS
Updates the cached manufacturer list maintained by the IEEE.
.DESCRIPTION
Update-ManufacturerList attempts to download the assigned list of MAC address prefixes using Get-WebContent.
The return is converted into an XML format to act as the cache file for Get-Manufacturer.
.PARAMETER Source
By default, the manufacturer list is downloaded from http://standards.ieee.org/develop/regauth/oui/oui.txt. An alternate source may be specified if required.