Skip to content

rd2000/PowerScriptCollection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowerScriptCollection

A custom collection of PowerShell functions, scripts, and code snippets.

This repository focuses on practical PowerShell utilities for transforming data, joining objects, managing secrets, and preparing data for further analysis.

One key tool is ConvertFrom-TextTable, which transforms unstructured text tables into structured objects.
Join-Objects and Rename-NoteProperty help merge and standardize object data.
ConvertTo-MSSQL supports storing object data in SQL Server for deeper analysis.


Quickstart

# From repository root
. .\functions\Join-Objects.ps1

$left = @([pscustomobject]@{ ID = 1; Name = "John" })
$right = @([pscustomobject]@{ ID = 1; Age = 30 })

Join-Objects -left $left -right $right -key 'ID'

Overview

Functions

Tools


Convert Objects to MSSQL

A generic function for converting PowerShell objects into MSSQL statements.
Converts PowerShell objects to Microsoft SQL Server statements.

See documentation for details.

Screenshot

ConvertTo-MSSQL screenshot

Join PowerShell Objects

A simple function to join two PowerShell objects based on a matching key.
The key must exist on both objects. The function returns merged objects.

See documentation for details.

Screenshot

Join-Objects screenshot

Rename NoteProperty of Objects

A function to rename one or multiple NoteProperty fields on objects.

See documentation for details.

Convert TextTable to Object

Converts a text table into an array of PowerShell objects.

This function reads a formatted text table and extracts data based on defined start positions and lengths provided in a JSON string.
The function removes specified header lines and returns a list of PowerShell objects.

See documentation for details.

Screenshot

ConvertFrom-TextTable screenshot

Get Custom Credential

Loads a credential, or creates it if it does not exist.

Get Custom Hash

Creates a hash from a string.
Helper function because PowerShell does not provide a built-in cmdlet to compute a hash directly from a string.

Reference: Get-FileHash

Screenshot

Get-CustomHash screenshot

Get Custom Password

Loads a custom password, or creates it if it does not exist.
Useful when commands do not support credentials directly.
The password is stored in encrypted form.

Convert Hex Columns to Decimal

Converts specified hex columns in an object array to decimal format.
Accepts an array of PowerShell objects and a list of column names containing hexadecimal values.
Converts the selected columns without modifying the original input array.

Find SNMP ARP GUI

A Windows Forms GUI for searching SNMP ARP tables.
The tool uses Net-SNMP snmpwalk to query configured routers and displays matching ARP entries with IPv4 address, DNS name, and MAC address.

Router definitions are stored in Tools/config/routers.json.
The app generates its local configuration files under $env:LOCALAPPDATA\SnmpArpGui\config; these files can also be edited, extended, or otherwise adjusted there.
Each router entry contains the router name, subnet information for the user, router IP or DNS name, SNMP community, and OID.
The GUI shows only the router selection and the related subnet hint; technical SNMP connection values are read from the configuration file.

Main features:

  • Select a router from routers.json
  • Show the configured subnet next to the router selection
  • Search by IPv4 address, MAC address, or free text
  • Optionally resolve DNS names
  • Export results to CSV
  • Copy selected result rows to the clipboard
  • Build a standalone EXE with Tools/build/Build-FindSnmpArpGuiExe.ps1

WebDAV File Downloader

PowerScriptCollection - WebDAV File Downloader
Downloads files from a WebDAV resource to a local directory.

By default, the script is prepared for image downloads (.jpg, .png).
It authenticates with a stored credential from Get-CustomCredential, reads the remote WebDAV index, filters matching files, and downloads only files that have not been downloaded before.

Main features:

  • Download JPG and PNG files from a WebDAV directory
  • Store files in a configurable local destination directory
  • Use saved credentials for authenticated WebDAV access
  • Keep a local link list to avoid downloading the same file again
  • Adapt the file filter for other file types if needed

Compress File to Gzip

Compresses a file to Gzip format.
By default, creates the .gz file in the same directory as the source file.
Optionally writes the output file to a different target path.

Expand SqlTemplate

Loads a SQL file and replaces placeholders with variable values.
Reads a SQL template file and replaces placeholders of the form {{PLACEHOLDER}} with matching values from the -Variables hashtable.

Get Custom SecretStore

Loads a custom configuration/secret object from CLIXML, or creates it if it does not exist.
Supports arbitrary fields (for example: ApiUrl, ApiToken, Username, Password, Tenant).
Selected fields can be stored as SecureString values (encrypted in CLIXML on Windows in the current user context).
Useful for API tokens, passwords, and general configuration data.

About

A custom collection of powershell functions, scripts and code snippets.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors