r/usefulscripts • • 12d ago

[Free Open-Source Tool] I combined 95+ Windows repair, diagnostics, Winget cloning, and USB rescue scripts into a single GUI for daily bench work (TREMEND Toolkit V3.3)

Thumbnail
gallery
59 Upvotes

Fellow techs, I wanted to share a free, open-source utility I built for my own daily bench work called **TREMEND Toolkit V3.3** (developed by **LennesVP**).

Instead of carrying dozens of separate `.bat` and `.ps1` scripts on a flash drive, I wrapped our most common diagnostic and repair workflows into a dark-mode Python GUI with an asynchronous terminal logger and a real-time CPU/RAM/Disk/Ping HUD.

🔗 **GitHub Source & Releases:** https://github.com/LennesVP/TREMEND

### ⚡ Biggest time-savers on the bench:

* **Pre-Format Software Cloner & Uninstaller:** Exports a clean `winget` `.json` (automatically filtering out UWP bloatware/VCLibs) + a `.csv` inventory to a USB drive before formatting a client's PC, and restores everything unattended. Also includes a deep uninstaller that purges leftover `AppData` and Registry keys.

* **License & OEM Key Passport:** Extracts the motherboard BIOS `OA3xOriginalProductKey`, decodes the Registry `DigitalProductId` (Base-24), checks `BackupProductKeyDefault`, and parses `slmgr /dlv` / `OSPP.VBS` channels (OEM, Retail, MAK, KMS) into a backup text file on the Desktop before a wipe.

* **Hardware Conflict Auto-Dorker:** Queries `Win32_PnPEntity` for devices with `ConfigManagerErrorCode != 0`, grabs the exact hardware ID (`VEN/DEV`), and launches a targeted search across Reddit, Microsoft, and Tom's Hardware.

* **USB Shortcut Virus Rescue & Vaccine:** Strips hidden/system attributes (`attrib -h -r -s`), deletes `.lnk`/`.vbs` traps, rescues nameless hidden folders, and creates an immutable `autorun.inf` lock folder.

* **One-Click Network & System Fixes:** Autonomous network reset (Winsock, TCP/IP, Host file reset, proxy purge, DHCP force), Print Spooler reset, Windows Update repair (`SoftwareDistribution`/`catroot2`), `Windows.old` forced removal, and smart `pagefile.sys` sizing.

It's completely free and open-source. Let me know what other bench scripts or WMI checks would save you time so I can add them in V3.4!


r/usefulscripts • • Jan 05 '26

[PowerShell] Get-WorkTime: PowerShell module to summarize work time from Windows event logs

39 Upvotes

Hi all,

Maybe it is useful for others as well:

Since I track my work time, I often can’t remember on Friday how I actually worked on Monday, so I needed a small helper.

Because my work time correlates pretty well with my company notebook’s on-time, I put together a small PowerShell module called Get-WorkTime.

It reads boot, wake, shutdown, sleep, and hibernate events from the Windows System event log and turns them into simple daily summaries (start time, end time, total uptime). There’s also an optional detailed view if you want to see individual sessions.

In case of crashes, it uses the last available event time and marks the inferred end time with a *. The output consists of plain PowerShell objects, so it’s easy to pipe into CSV or do further processing.

The code is on GitHub here: https://github.com/zh54321/Get-WorkTime

Feedback or suggestions are welcome.

Cheers


r/usefulscripts • • 19d ago

[PowerShell] ConsoleMonster PowerShell module

Post image
22 Upvotes

I've written Powershell module and .NET library in one allows you to make your daily terminal a bit more fun to play with. By using Enable-ConsoleFormatting it converts daily cmdlets such as Get-ACL, Format-Table, Format-List into their better versions. However that's just a super simple use case. The module has over 100 cmdlets to build stuff in Terminal making it super pretty and actually useful.

You can make your own powershell scripts super pretty and all demos (40+) on website show exactly how. Each demo has a video showing what you get, and script that generates it. Since the videos are generated using ConsoleMonster you can for example record your own "powershell console" experience and use in presentations or on websites.


r/usefulscripts • • Oct 28 '26

[PowerShell] Azure Network Topology to Draw.io Files

Thumbnail
gallery
18 Upvotes

Maybe it is useful for others as well:

As a security analyst, I’ve always found Azure network reviews tedious. In environments without consistent naming or structure, things get chaotic quickly, and understanding the setup can take a hundreds clicks in the portal. I usually ended up drawing the network in draw.io by hand.

Since draw.io files are XML, I wondered how much of that work I could automate. That became VNetAtlas. It generates editable diagrams showing VNets, subnets, peerings, resources, and connected components such as gateways, NSGs / Azure FW (including the rules), and public IPs. It uses the AZ PS Module for authentication and to run the KQL queries.

I mainly use it to get an overview of the network and its components, review NSG / Azure FW rules.

Note: The code was written with substantial help from AI coding assistants. I’m sharing it in case it saves someone else a few clicks, or a few tokens spent building something similar.

Feel free to try it, share feedback, down-vote or ignore it:

https://github.com/zh54321/VNetAtlas


r/usefulscripts • • Jan 27 '26

[Rust] Dockyard, a snappy TUI for Docker container management.

15 Upvotes

Got pissed off that the first TUI I wrote (in Python) was too slow for my $5/m VPS instance so I ported it to Rust. Now it's fast.

Repo: https://github.com/905timur/dockyard


r/usefulscripts • • Jun 30 '26

[PYTHON] Sunnify: open-source tool to archive Spotify playlists locally (run from source or GUI)

12 Upvotes

Open-source Python tool for archiving Spotify playlists locally with full metadata. Run it from source, or use the bundled desktop GUI.

  • Pulls metadata (title, artist, album, year, cover art) from Spotify embed pages

  • Audio via yt-dlp, MP3 with ID3 tags

  • Handles whole playlists, sorted into folders

  • Cross-platform (Windows / macOS / Linux)

GitHub: https://github.com/sunnypatell/sunnify-spotify-downloader


r/usefulscripts • • Feb 12 '26

[PowerShell] PSParseHTML / HtmlTinkerX - html parsing, browsing, css/js minifying etc made easy

10 Upvotes

Hi,

So some months ago I've rewritten PSParseHTML into full blown C# library with PowerShell cmdlets and it's now a bit more then just HTML parser.

🔍 HTML Parsing - Multiple parsing engines (AngleSharp, HtmlAgilityPack)

🎨 Resource Optimization - Minify and format HTML, CSS, JavaScript

🌐 Browser Automation - Full Playwright integration for screenshots, PDFs, interaction

📊 Data Extraction - Tables, forms, metadata, microdata, Open Graph

📧 Email Processing - CSS inlining for email compatibility

🔧 Network Tools - HAR export, request interception, console logging

🍪 State Management - Cookie handling, session persistence

📱 Multi-Platform - .NET Framework 4.7.2, .NET Standard 2.0, .NET 8.0

It's divided into 2 parts:

  • HTMLTinkerX which is C# library so I can take it to my C# libraries world

  • PSParseHTML v2 which is using HtmlTinkerX behind the scenes.

It automates all parsing, but also now able to fully browse websites and parse it there, parse forms, go thru logins etc. It uses Playwright and automates the installation process so it's used on demand.

The repository:

Has all the required details about new cmdlets, examples how to use etc.

I know I'm not staying here much, I tend to post more on daily basis to X or LinkedIn, but lately I've rewritten lots of my modules to C# for functionality so you may want to check them out.

Enjoy


r/usefulscripts • • Sep 01 '26

[POWERSHELL] MonitorAutoSwitch - automatically moves your laptop display to the correct side of your monitor (home vs office) based on public IP

8 Upvotes

A small PowerShell tool for anyone who docks their laptop in two places with the screen on different sides.

What it does: detects your location via public IP and repositions the laptop display on the correct side (left/right) of the main monitor. Runs on logon, wake and display connect, plus a once-a-minute display-count watcher. WinForms setup wizard, system tray toggle, per-user install (no admin, lives in %LOCALAPPDATA% + Task Scheduler).

Technical notes: positions are computed from the live display widths on every run instead of stored absolute coordinates - that plus per-monitor DPI awareness (SetProcessDpiAwarenessContext) turned out to be the fix for intermittent DISP_CHANGE_FAILED (-1) errors from ChangeDisplaySettingsEx after docking.

GitHub (MIT): https://github.com/dimitrihilverda/MonitorAutoSwitch

Disclosure: written in pair-programming style with Claude. Feedback welcome.


r/usefulscripts • • Jun 07 '26

[POWERSHELL] Made a registry-based Get-InstalledApps

Thumbnail
reddit.com
8 Upvotes

r/usefulscripts • • May 14 '26

Do GitHub actions count? [Block-Clankers] auto-blocks PR spam bots from your repos

Post image
8 Upvotes

I just published ‘Block-Clankers’

A GitHub action that auto-blocks the AI-slop bots flooding your pull requests.

Just fork it -> add your token -> Done

It auto-syncs your blocks with a community maintained Clanker list every 30min.

https://github.com/CyrisXD/block-clankers


r/usefulscripts • • Jun 12 '26

[Bash/Zsh]: Add, commit and push to all remotes in one line

7 Upvotes

Ever felt tired of typing the same commands :

git add .
git commit -m <MEssage>
git push origin main

This becomes even more tedious when there are multiple remotes.

My script makes it easy. It uses fzf to choose the commit type (feat(), fix() etc) and opens your $EDITOR to make you write the commit. It also allows you to write long commit messages and adheres to the conventional commits specs. It also signs off your commit (Can be modified to your liking).

Here is the script

https://github.com/Vaishnav-Sabari-Girish/dotfiles/blob/35f55a46ffd8f31dd6299df149178353d769f367/zsh/.zsh_functions#L51


r/usefulscripts • • Aug 12 '26

[powershell] For a hybrid environment, fixing users that don't have a mail field filled out (and their other missing related fields)

6 Upvotes

In our environment, we had a few hundred users that were migrated to the cloud in the past before we started using new-remotemailbox and before we did dynamic exchange licensing.

This script targets those users without a mail field and corrects it using enable-remotemailbox to connect the two, and then set-remotemailbox to connect it to the defined GUID of the cloud mailbox. Use only if you still have your on-prem exchange.

Use at your own risk (test it thoroughly), this was very hyperspecific to my situation but I felt others may find it useful.

Is the script efficient? No. But each step goes further down and down into making a useable data set that I could verify.

# 1. Prerequisites and Configuration
# Ensure you run this from a computer with access to the on-premises Exchange Management Shell.
Import-Module ActiveDirectory

# Define your target OU Distinguished Name and your tenant routing domain
$TargetOU       = "OU=Users,DC=contoso,DC=com"
$RoutingDomain  = "yourdomain.mail.onmicrosoft.com"
$AzureADCServer = "AzureADConnectServer01"
$OnPremExchURI  = "http://Exch01.contoso.com/PowerShell/"

# 2. Gather on-prem AD users with an empty mail field
$usersToUpdate = @()
$emptyMailUsers = Get-ADUser -SearchBase $TargetOU -Filter {mail -notlike "*"} -Properties SamAccountName, UserPrincipalName, mail

# 3. Fetch those users Cloud Exchange GUIDs
Write-Host "Connecting to Exchange Online..." -ForegroundColor Cyan
Connect-ExchangeOnline -ShowBanner:$false
foreach ($user in $emptyMailUsers) {
    # Query Exchange Online for the user's ExchangeGuid
    $cloudMailbox = Get-Mailbox -Identity $user.UserPrincipalName -ErrorAction SilentlyContinue
    if ($cloudMailbox) {
        # Add the user and their GUID to our array
        $usersToUpdate += [PSCustomObject]@{
            FullEmail       = $user.UserPrincipalName
            UName           = $user.SamAccountName
            ExchangeGuid    = $cloudMailbox.ExchangeGuid
        }
        Write-Host "Found GUID $($cloudMailbox.ExchangeGuid) for user $($user.UserPrincipalName)" -ForegroundColor Green
    } else {
        Write-Host "Mailbox not found in Exchange Online for $($user.UserPrincipalName)" -ForegroundColor Yellow
    }
}

# 4. Disconnect from Exchange Online
Disconnect-ExchangeOnline -Confirm:$false


# 5. Connect to On-Premises Exchange
Set-ExecutionPolicy RemoteSigned -Force -ErrorAction SilentlyContinue
Get-PSSession | Where-Object {$_.ConfigurationName -eq "Microsoft.Exchange"} | Remove-PSSession
Write-Host "Enter your on-prem exchange management credentials" -BackgroundColor "Yellow" -ForegroundColor "Black"
$ExchServerCredentials = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $OnPremExchURI -Authentication Kerberos -Credential $ExchServerCredentials
Import-PSSession $Session -DisableNameChecking


# 6. Loop through the array to run Enable-RemoteMailbox and apply the GUID
foreach ($record in $usersToUpdate) {
    try {
        # Convert local user to a Remote Mailbox linked to the cloud
        Write-Host "Enabling Remote Mailbox on-premises..." -ForegroundColor Cyan
        $TargetRoutingAddress = "$($record.UName)@$RoutingDomain"
        Enable-RemoteMailbox -Identity $record.UName -RemoteRoutingAddress $TargetRoutingAddress | Out-Null


        # Inject the Cloud GUID into the on-premises user object to link them natively
        Write-Host "Matching ExchangeGUID locally..." -ForegroundColor Cyan
        Set-RemoteMailbox -Identity $record.UName -ExchangeGuid $record.ExchangeGuid


        Write-Host "Successfully linked $($record.FullEmail) locally." -ForegroundColor Green
    }
    catch {
        Write-Error "Failed to process $($record.FullEmail). Error: $_" -ForegroundColor Red
    }
}

# 7. Clean up on-prem session
Remove-PSSession $Session
Start-Sleep -Seconds 10

# 8. Force Delta Sync
# Triggers Entra Connect to immediately replicate these changes to Microsoft 365
Write-Host "--------------------------------------------------" -ForegroundColor Gray
Write-Host "Triggering Microsoft Entra Connect Sync..." -ForegroundColor Cyan
Invoke-Command -ComputerName $AzureADCServer {start-adsyncsynccycle -policytype Delta}

Write-Host "Process complete!" -ForegroundColor Green

r/usefulscripts • • Jun 03 '26

[PowerShell]: Export Microsoft 365 Copilot Agent Inventory and Availability Assignments

Thumbnail reddit.com
6 Upvotes

r/usefulscripts • • Feb 06 '26

I built a 100% client-side image optimizer to stop wasting API tokens on simple compression [JavaScript]

Thumbnail reddit.com
6 Upvotes

r/usefulscripts • • Jul 12 '26

[Built a PowerShell-based MSSQL Daily Health Check HTML Report Tool. Looking for feedback and ideas.]

Thumbnail github.com
4 Upvotes

r/usefulscripts • • Feb 24 '26

"[can someone please tell me what's wrong with this script]"

Post image
4 Upvotes

This is a powershell script I wrote based on someone else's example. It's intended to be used in conjunction with task scheduler and meant to run in the background. Its purpose is to backup a specific folder in regular intervals. It's supposed to copy the folder to a specified destination, compress it to a zip file and then delete the original non-zipped copy. It's also supposed to retain and maintain only the last seven copies.

However it doesn't always delete the original non zipped copies, (works about half the time) nor does it run in the background or exit powershell when finished. It will pull up the Powershell window every single time the script runs. It's especially irritating when I'm gaming in full screen mode because it will disable it to run the script. Normally, it'll just pop up over or behind any other window I have open.

I'm fairly new to scripting and have only written a few simple scripts so far, so I'm not entirely sure where I went wrong or how to go about fixing it. Any assistance would be appreciated.


r/usefulscripts • • Jun 27 '26

[Chrome Add In] Created a Chrome Add in For helping build automations

Thumbnail
reddit.com
3 Upvotes

r/usefulscripts • • May 27 '26

[how to read the text of a dropdown field in an autoitv3 script?]

3 Upvotes

i know autoit is super old, but rigth now is what is working, so i have to use it, i wanted to ask if anyone knows wich library or UDF from autoit will let me get the text of a dropdown field so i can compare it to a String.


r/usefulscripts • • Apr 02 '26

[userscript] I made a script that shows subreddit total members.

3 Upvotes

r/usefulscripts • • Feb 03 '26

Fivem police radar script]

3 Upvotes

does anybody know who made this radar script for fivem?


r/usefulscripts • • Jan 16 '26

[JavaScript] Make Text Highlight URL bookmarklet

3 Upvotes

Browser bookmarklet to make text highlight URL (aka. Text Fragment or URI Fragment [*]) so that, the text highlight can be preserved in bookmarks, or be shared to others.

Simply select one or more text, then invoke the bookmarklet. The URL of the current browser tab should change.

Notes:

  • Text Fragments only work on static text. It won't work for text which are dynamically generated after the HTML is parsed by the browser. Typically, those which as JS generated.

  • Currently, only Firefox and its forks support multiple selections without requiring a helper browser extension.

  • If a text from one specific selection has multiple matches on the page, only the first one is highlight - as stated in the text fragment specification (https://wicg.github.io/scroll-to-text-fragment/#fragmentdirective). This may cause the URL to highlight a text from the wrong context. In this case, expand the text selection to make it more unique and produce only one match for the whole page.

  • Firefox and forks may still have implementation problem for the text highlighting. Page refresh may be required after the URL has changed for the new text highlight. Otherwise, the text highlight specified from previous URL won't be removed.

[*]

https://en.wikipedia.org/wiki/URI_fragment

https://web.dev/articles/text-fragments

https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Text_fragments

The code:

javascript:/*MakeTextHighlightURL*/
((s, i, r, a, b, t, j, k, x0, x1) => {
  function f(r, j, k) {
    j = b.indexOf(r[0]);
    k = b.indexOf(r[1], j + r[0].length) + r[1].length;
    return [j, k, k - j];
  }
  s = getSelection();
  if (s.rangeCount) {
    for (i = s.rangeCount - 1; s >= 0; s--) {
      r = s.getRangeAt(i);
      if (r.collapsed) s.removeRange(r)
    }
  }
  if (!s.rangeCount) return alert("No text selection.");
  a = [];
  b = document.body.textContent.toLowerCase();
  x0 = /\s*\W*\w+\W*\s*$/;
  x1 = /^\s*\W*\w+\W*\s*/;
  for (i = 0; i < s.rangeCount; i++) {
    t = s.getRangeAt(i).toString().trim().toLowerCase();
    if (t.split(/\s+/).length > 3) {
      j = Math.floor(t.length / 2);
      r = [t.substr(0, j), t.substr(j)];
      r[0] = r[0].replace(/\s*\W*\w+\W*$/, "").trim();
      r[1] = r[1].replace(/^\s*\W*\w+\W*/, "").trim()
    } else r = [t];
    if (r.length > 1) {
      r[0] = r[0].trim();
      r[1] = r[1].trim();
      j = f(r);
      if (j[2] === t.length) {
        k = r.slice();
        while (true) {
          k[0] = k[0].replace(x0, "");
          if (!k[0]) break;
          j = f(k);
          if (j[2] !== t.length) break;
          r = k.slice()
        }
        k = r.slice();
        while (true) {
          k[1] = k[1].replace(x1, "");
          if (!k[1]) break;
          j = f(k);
          if (j[2] !== t.length) break;
          r = k.slice()
        }
      } else r = [t]
    }
    a.push(r.map(s => encodeURIComponent(s)).join(","))
  }
  if (!a.join("")) return alert("No text selection.");
  location.hash = "#:~:" + a.map(s => "text=" + s).join("&")
})()

r/usefulscripts • • Jan 07 '26

[ help with simple scroll and click automation

3 Upvotes

I don't know if this is a good place to ask, feel free to suggest other subreddits. But I'm looking to automate what I would assume to be very simple, yet have had no luck so far looking. I only need 2 actions to be repeated perpetualy. 1. Click 2. Scroll down a designated amount. And just repeat. I need to click every item in a very long list, at the same position on each item, and each item has exactly the same spacing. So the specific amount it scrolls after ever click always remains the same. The buttons that need to be clicked are also all aligned vertically, so the mouse doesn't need to move left or right at all and can stay in the same place. The scroll moving the entire page up would serve for moving the mouse onto the next item to click. How would I go about automating this, any help would be greatly appreciated.


r/usefulscripts • • Sep 05 '26

[Python]Short script

Thumbnail reddit.com
2 Upvotes