Skip to content

rd2000/PowerScriptCollection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 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

Scripts


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.

WebDAV File Downloader

PowerScriptCollection - WebDAV File Downloader
Downloads image files (JPG, PNG) from a WebDAV resource to a local directory.

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

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors