Skip to content

Instantly share code, notes, and snippets.

View scriptingstudio's full-sized avatar
👍
Awake and ready

Matthew Gray scriptingstudio

👍
Awake and ready
  • Interstellar Systems
  • Hiranyaloka
View GitHub Profile
@scriptingstudio
scriptingstudio / ProtectedString.cs
Created April 19, 2026 18:13
Experimental C# string encryptor
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
namespace Encryption
{
public class Encryption //: IDisposable
{
@scriptingstudio
scriptingstudio / ProtectedString.ps1
Created April 19, 2026 06:57
Experimental encryption module for simple cases.
<#
.SYNOPSIS
Encrypt/decript strings.
.DESCRIPTION
AIO encryption dotsource mini-module.
The module supports AES and DPAPI encryption methods.
.FUNCTIONALITY
Encryption method: Protect-String
Decryption method: UnProtect-String
Data method: Get-CipherData
@scriptingstudio
scriptingstudio / Compress-ScriptBlock.ps1
Last active March 20, 2026 07:15
Simple PowerShell script compressor. The script works like "ConvertTo-Json -Compress". Two editions: System.Management.Automation.PSParser and System.Management.Automation.Language.Parser
<#
.SYNOPSIS
Removes comments and extra white space from an input PS script.
.DESCRIPTION
The filters omit white space and indented formatting in the output. Filters are comments, newlines, spaces, statement separator (;).
.PARAMETER Path
Specifies the path to the PS file to compress.
.PARAMETER ScriptBlock
Specifies the PowerShell scriptblock to compress.
.PARAMETER NoTest
@scriptingstudio
scriptingstudio / ps2exe.ps1
Last active April 20, 2026 16:01
PS2EXE script deeply refactored replacing outdated techniques and overloaded logics with modern look and feel. Source compressor added to reduce output size. Source encoding, the return of the king. Implemented as a dotsource module.
#Requires -Version 5
# Insipred by and credits to PS2EXE by Markus Scholts (https://github.com/MScholtes/PS2EXE)
<#
.SYNOPSIS
Converts powershell scripts to standalone executables.
.DESCRIPTION
Converts powershell scripts to standalone executables. GUI output and input is activated with one switch, real windows executables are generated. You may use the graphical front end Win-PS2EXE for convenience.
Please see Remarks on project page for topics "GUI mode output formatting", "Config files", "Password security", "Script variables" and "Window in background in -noConsole mode".
@scriptingstudio
scriptingstudio / compare-array.ps1
Last active February 21, 2026 13:14
Yet another PS object fast comparer (2 editions)
function Compare-Array {
[CmdletBinding()]
[alias('Compare-Object2','Compare-ObjectFast')]
param (
[Parameter(Position=0)]
[psobject[]] $ReferenceObject,
[Parameter(Position=1)]
[psobject[]] $DifferenceObject,
[switch] $IncludeEqual,
[switch] $ExcludeDifferent
@scriptingstudio
scriptingstudio / Get-FolderItem.ps1
Last active February 19, 2026 07:37
Fast File Finder. Lists all files under a specified folder regardless of character limitation on path depth. Based on Robocopy.
<#
Virtual multifunction via single function without additional parameters
Get-FolderItem - list files
Remove-FolderItem - delete files
Copy-FolderItem - copy files
Move-FolderItem - move files
#>
function Get-FolderItem {
[cmdletbinding(DefaultParameterSetName='Filter')]
[alias('Remove-FolderItem','Copy-FolderItem','Move-FolderItem')] #,'rfi','cfi','mfi','gfi'
@scriptingstudio
scriptingstudio / slmgr-ps.ps1
Created February 4, 2026 06:47
SLMGR PowerShell workshop/framework to explore Windows activation management
#Requires -Version 5
<#
.SYNOPSIS
Windows Software Licensing Management Tool
.DESCRIPTION
SLMGR PowerShell workshop/framework to explore Windows activation management.
This is a ported slmgr.vbs script.
.NOTES
- Prerelease prototype
@scriptingstudio
scriptingstudio / filelocktester.ps1
Last active January 1, 2026 18:14
Simple File Lock Tester
function Test-FileLock ([string]$Path, [int]$TimeOutMs, [int]$Count) {
$timeout = $TimeOutMs
if ($timeout -lt 0) {$timeout = 0}
if ($Count -gt 0) {$Count--} else {$Count = 0}
do {
try {
$OFile = [System.IO.FileInfo]::new($Path)
$OStream = $OFile.Open([System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None)
if ($OStream) {$OStream.Close()}
return $false
@scriptingstudio
scriptingstudio / EventInfo.ps1
Last active January 10, 2026 09:22
Simple Windows Event Log Converter
# NOTE: XML doesn't take data types into account; it can be retrieved from event.Properties.Value, and the names can be taken from XML
# NOTE: Event data without names can only be retrieved from event.Properties.Value
function Convert-EventLog {
[cmdletbinding()]
[alias('cvev','Get-EventLogInfo')]
param (
[Parameter(Position=0,Mandatory,ValueFromPipeline)]
#[System.Diagnostics.Eventing.Reader.EventLogRecord[]]
[alias('inputobject')]$EventObject,
[switch]$noType, # return event data as text
@scriptingstudio
scriptingstudio / fixmac.ps1
Last active July 11, 2025 15:10
Work around for a faulty network adapter
#Requires -RunAsAdministrator
<#
There are weird computers having physical netadapters without macaddress.
This script finds faulty netadapters and assigns a random macaddress to the adapter
#>
Get-NetAdapter -Physical -ErrorAction 0 | Where-Object {
$_.InterfaceDescription -notmatch 'Wireless|wi-fi|virt|Hyper-V' -and $_.MacAddress -eq '00-00-00-00-00-00'
} | ForEach-Object {