A collection of useful scripts and code snippets gathered over the years. Use & modify as you wish.
- System Administration
- Windows Automation
- Datto RMM
- Cloud & DevOps
- Commvault, TSM, Veeam
- Media Processing
- Network & Security
- Utilities
- Script-Specific Instructions
- check-linux-updates-and-push-to-ntfy.sh - Checks a Ubuntu/Debian Linux server for package updates and notifies via Ntfy.sh
- Administrator-SelfElevate.ps1 - Make your PowerShell scripts self elevate to run as an Administrator
- Convert-DsRegCmd.ps1 - Take DSREGCMD /status output and turn into a PSObject. Very handy stub for a variety of scripting tasks
- Convert-FSUtilToObject.ps1 - Converts FSUTIL output into a powershell custom object for easy parsing
- Dump-Env.ps1 - Outputs all ENVIRON variables (Env:) to stdout, useful for Datto RMM / DRMM work
- EnableDisable-FileSecurity.ps1 - Powershell byte-sized one-liners for disabling then re-enabling that pesky "Open File - Security Warning" dialog
- Enable-WindowsSandbox-OnHomeEdition.ps1 - Enable Windows Sandbox on Windows 10 & 11 Home Edition
- Get-ActiveSpeaker.ps1 - Returns active speaker on a Windows 10/11 machine
- Get-PendingReboot.ps1 - PSH Function to check server if a pending reboot condition exists
- Get-ProcessByCPUUsage.ps1 - Get a sorted list of processes using more than 5% CPU
- Get-NetworkStatistics.ps1 - For troubleshooting script - get network stats
- Get-ServicesUsingServiceAccounts.ps1 - One-liner to show all services on a machine using something other than SYSTEM/LocalService/NetworkService
- Get-UserSecurityGroups.ps1 - Get security groups for a given user
- Get-WindowsUpdates.ps1 - Get a list of Windows Updates and the status of that individual patch (& whether it was installed/uninstalled)
- NewMachine_InstallChrome.ps1 - Downloads Chrome installer using BITSTransfer and installs it
- Read-IniFile.psm1 - Function to read INI files in as a PowerShell Object
- Remove-Notepad.ps1 - Remove Notepad++ across a fleet of machines
- ReregisterApp.ps1 - Re-registers applications on Windows (handy when Calculator starts freezing like crazy)
- Reset-WindowsHello.ps1 - Resets Windows Hello and NGC (Next Generation Credentials) to fix authentication issues
- Show-DiskUsage.ps1 - du -h for Windows
- Update-WSLDistros.ps1 - Powershell script to update all WSL distros via RMM script
- wmi_poll_servers.ps1 - Poll servers via WMI and extract key information into CSV/Excel
- Disable-MicrosoftCopilot.ps1 - Disables Microsoft Copilot by removing the Appx package & changing the GPO reg key if it exists
- DRMM-CheckRefreshRate.ps1 - Monitor component - checks that the refresh rate across all screens doesn't fall below a minimum value
- DRMM-Testrig-Monitor-ForceStatus.ps1 - Monitor component - forces a specific status/message for testing monitoring processes
- DRMM-PopulateUDFwithDNSServers.ps1 - Script - populates a UDF with the DNS servers addresses on a Windows machine
- DRMM-macOS-CheckForNonAPFSvols.sh - Monitor component - looks for non-APFS vols by calling diskutil
- DRMM-macOS-disable-ipv6.sh - Disables IPv6 on all interfaces on a given macOS endpoint
- Get-NextDNSEnforcementStatus.ps1 - Script for RMM to monitor NextDNS and avoid common bypasses
- Set-NextDNSEnforcement.ps1 - Script for RMM to enforce NextDNS and avoid common bypasses
- Get-ScreensaverComplianceStatus.ps1 - Script for RMM to monitor desired screensaver settings are in place (enabled, 10min timeout, return to login screen)
- Set-ScreensaverCompliance.ps1 - Script for RMM to enforce screensaver
- Get-NTPtoCloudFlareStatus.ps1 - Forces Windows 10 & 11 to use CloudFlare's NTP servers
- Set-NTPtoCloudFlare.ps1 - Forces Windows 10 & 11 to use CloudFlare's NTP servers
- Set-DisableSleeponACPower.ps1 - Script for RMM to disable sleep on AC power and lid close, and disable Hibernation entirely (helps Bitlocker stay active)
- Get-WhosLoggedIn.ps1 - Pull list of logged on users on the local machine
- docker_update.ps1 - Update all docker images on local workstation (Windows/PowerShell)
- docker_update.sh - Update all docker images on local workstation (macOS-Linux/Bash)
- droplet_get_ip.py - Get IP Address of a DigitalOcean Droplet
- Get-DockerRestartString.sh - Returns the docker commandline for an existing container so you can restart it
- lambda_autoShutdown.py - AWS Lambda function to auto-shutdown instances, unless it has a specified ignoreTag
- Update-Route53.ps1 - Runs at time of EC2 start to update/create CNAME record based on instance's public host name
note: these backup software scripts are significantly out-of-date and being retained only for archival purposes
- CV-RESTAPI-DumpEdgeDriveContentsToHTML.ps1 - Script to dump the contents for a given Commvault Edge Drive path out to HTML
- CV-RESTAPI-ExecuteWorkflowAsGETCall.ps1 - Script to call Commvault workflow
- CV-RESTAPI-QOperationExecute-DisableAllJobActivity.ps1 - Script to submit into XML message bus
- CV-RESTAPI-QOperationExecute.ps1 - Script to perform example QOperation Execute command for Commvault
- veeam_cbtbug_fix.ps1 - Workaround script for Veeam KB 2090639
- parseTSM.py - Scrapes backup completion times from TSM mmbackup log entries
- Generate_MSSQL_Activity.ps1 - Generates random activity in an AdventureWorks2022 database for LAB environments
- FindVMsbyUUID.ps1 - Find VMware VMs by UUID (requires PowerCLI)
- PowerCLI-VMware-FindVMsbyUUID.ps1 - One-liner powershell script to find VMs by UUID
- vss_mount_and_work.ps1 - Script to create and mount a VSS snapshot, do work, then clean up
- convert_mov_to_mp4.sh - Converts .MOV (or any movie file) to MP4 using FFMPEG
- exif_plot.py - Extracts GPS Info via EXIF from files and plots on Google Maps
- ffmpeg-ConvertAC3toAAC.ps1 - Converts all AC3 files in a directory to AAC files using ffmpeg
- Force-TLS12forPowershell.ps1 - Stub to force TLS12 or better as the default for Powershell
- Get-SChannelCipherList.ps1 - Determines what SSL & TLS ciphers are supported on Windows
- Test-TLSConnection.ps1 - Attempts TLS connections with specific TLS versions
- validate_tls_version.sh - Validates if a HTTPS server will accept a specific TLS version using cURL
- ETL_MSSQL.py - Rudimentary ETL load left-to-right with pyodbc & MS-SQL
- exceltricks_formatToGB.txt - Excel Trick for formatting a given number into MB/TB/GB/PB
- facebook-messenger-archive-everything.md - Archive all your Facebook Messenger chats
- Get-FolderSize.ps1 - Scan folder recursively and output CSV file with file & sizes
- lease_check.py - Quick check on value of a car lease (US)
- Send-Pushbullet.ps1 - Pushbullet notification for uTorrent
- SortDropboxCameraUploads.ps1 - Sorts Dropbox Camera Uploads folder by year/month into Photos folder
To be wrapped with a batch file - uTorrent calls this batch file, which then calls this PSH:
- To setup in uTorrent:
- Open Preferences
- Under Advanced, select Run Program
- Set "Run this program when a torrent finishes:" to " %N"
Batchfile contents:
@echo off
powershell.exe -ExecutionPolicy unrestricted -command "& { . D:\Send-Pushbullet.ps1 -Body %1 }"