Month: December 2025

Just another Tech site

PowerShell: Base64 compression to clipboard

Using the Base64 to embed logos into a Windows form and then compressing the image to reduce the footprint of the size of the code. Add-Type -AssemblyName System.IO.Compression $imagePath = “Location to file\firefoxlogosmall.png” $bytes = [System.IO.File]::ReadAllBytes($imagePath) $ms = New-Object System.IO.MemoryStream $gzip = New-Object System.IO.Compression.GZipStream($ms, [System.IO.Compression.CompressionMode]::Compress) $gzip.Write($bytes, 0, $bytes.Length) $gzip.Close() $base64 = [Convert]::ToBase64String($ms.ToArray()) Set-Clipboard -Value $base64…
Read more

PowerShell: Remove folders older than x amount of days

Trying to do a clean up of installation version folders for applications installed after x amount of days.  This will remove folders and files in subfolders older than 4 days  as scripted below.  Change the variables to help identify the folder locations.  Please run on a test system before using for production, just to make…
Read more

PowerShell: update to Embed Audio file

Trying to get that the data stream is on one line vs hundreds of lines. The change was in the Convert to Base64 block. I found that I needed to add some additional parameters: [Convert]::ToBase64String($encrypted, [Base64FormattingOptions]::None) This will output the data stream to a one line, and even if output to a text file, now…
Read more