A PowerShell 7+ module for day-to-day IT automation: browser profile cleanup, remote software inventory, Purview eDiscovery workflows, EXO message trace, battery health parsing, AAD Connect remote sync, and more.
This is a new project to fold all (okay most) of my scripts into an enterprise-grade PowerShell module.
- Getting Started
- Configuration
- Public Commands
- Get-ToolboxHelp
- Clear-BrowserProfileData
- Get-RemoteInstalledSoftware
- Invoke-PurviewPurge
- Get-MessageTrace
- Get-BatteryHealth
- Invoke-AADSyncRemote
- Get-TechToolboxConfig
- Set-PageFileSize
- Invoke-DownloadsCleanup
- Invoke-SubnetScan
- Test-PathAs
- Copy-Directory
- Invoke-SystemRepair
- Get-WindowsActivationInfo
- Reset-WindowsUpdateComponents
- Set-ProxyAddress
- New-OnPremUserFromTemplate
- Get-SystemSnapshot
- Search-User
- Disable-User
- Remove-Printers
- Design & Conventions
- Troubleshooting
- Development & QA
# This module is designed for PowerShell 7
# Import module from a local path
Import-Module .\TechToolbox -Force
# See exported commands
Get-Command -Module TechToolbox | Sort-Object Name
# View help for any command
Get-ToolboxHelp Clear-BrowserProfileData -DetailedThe module auto-loads functions from
Private/(helpers) andPublic/(exported), and caches configuration viaGet-TechToolboxConfig.
Create Config\config.json and tailor to your environment. Below is a minimal
example with commonly used sections. Omit any you do not need; defaults will
be applied where sensible. The full config.json is located here.
{
"paths": {
"temp": "C:\\Temp\\TechToolbox",
"logs": "C:\\LogsAndExports\\Logs\\TechToolbox",
"exportDirectory": "C:\\LogsAndExports\\Exports\\TechToolbox"
},
"settings": {
"defaults": {
"promptForHostname": true,
"promptForCredentials": true,
"promptForDateRanges": true,
"promptForCaseName": true,
"promptForSearchName": true,
"promptForKqlQuery": true
},
"logging": {
"enableConsole": true,
"enableFileLogging": false,
"includeTimestamps": true,
"logFileNameFormat": "TechToolbox_{yyyyMMdd}.log",
"minimumLevel": "Info"
},
"dnsLogging": {
"enabled": true,
"autoEnableDiagnostics": true,
"parseMode": "simple",
"maxLogSizeMB": 50,
"logPath": "C:\\LogsAndExports\\TechToolbox\\Logs\\DNS"
},
"copyDirectory": {
"runRemote": true,
"defaultComputerName": null,
"logDir": "C:\\LogsAndExports\\TechToolbox\\Logs\\Robocopy",
"retryCount": 2,
"waitSeconds": 5,
"copyFlags": ["/E", "/COPYALL"],
"mirror": false
},
"subnetScan": {
"pingTimeoutMs": 250,
"tcpTimeoutMs": 500,
"httpTimeoutMs": 1000,
"ewmaAlpha": 0.15,
"displayAlpha": 0.1,
"defaultPort": 80,
"exportCsv": true,
"resolveNames": true,
"httpBanner": true
}
}
}A standard help function.
Get-ToolboxHelp
# Show Effective Config switch
Get-ToolboxHelp -ShowEffectiveConfigDeletes cache, cookies, and (optionally) local storage for Chrome/Edge profiles. Supports -WhatIf/-Confirm.
# Preview cleanup for both browsers
Clear-BrowserProfileData -WhatIf
# Target Chrome only and just cache
Clear-BrowserProfileData -Browser Chrome -IncludeCache:$true -IncludeCookies:$false
# Target specific profiles, skip local storage
Clear-BrowserProfileData -Browser Edge -Profiles 'Default','Profile 2' -SkipLocalStorageCollects installed software from remote Windows hosts via PSRemoting (registry uninstall keys; optional Appx/MSIX). Exports per-host or consolidated CSV.
# Query two servers, consolidated CSV
Get-RemoteInstalledSoftware -ComputerName srv01,srv02 -Consolidated
# Include Appx packages, prompt for credentials
Get-RemoteInstalledSoftware -ComputerName laptop01 -IncludeAppx -Credential (Get-Credential)
# Preview without writing any files
Get-RemoteInstalledSoftware -ComputerName srv01,srv02 -WhatIfEnd-to-end Purview HardDelete workflow: connect, clone/create mailbox-only search, wait for completion, submit purge, optional disconnect.
# Normal run
Invoke-PurviewPurge -UserPrincipalName admin@company.com -CaseName "Case-001" -SearchName "CustodianSearch-01"
# Preview purge submission
Invoke-PurviewPurge -UserPrincipalName admin@company.com -CaseName "Case-001" -SearchName "CustodianSearch-01" -WhatIfRuns EXO V2 message trace by RFC822 Message-ID, shows summary and per-recipient details, and optionally exports CSVs.
# 24-hour lookback window (defaults from config)
Get-MessageTrace -MessageId '<abc123@company.com>'
# Custom date window
Get-MessageTrace -MessageId '<abc123@company.com>' -StartDate (Get-Date).AddHours(-12) -EndDate (Get-Date)
# Auto-export to default folder
Get-MessageTrace -MessageId '<abc123@company.com>' -WhatIfGenerates powercfg /batteryreport, parses the Installed batteries table from HTML, computes health metrics, and writes JSON.
# Use config defaults
Get-BatteryHealth
# Custom paths, preview only
Get-BatteryHealth -ReportPath 'C:\Temp\battery-report.html' -OutputJson 'C:\Temp\batteries.json' -WhatIfRemotely triggers Azure AD Connect (Start-ADSyncSyncCycle) using PSRemoting. Kerberos or credential-based.
# Delta sync using defaults
Invoke-AADSyncRemote -ComputerName 'aadconnect01'
# Initial sync via Kerberos, preview only
Invoke-AADSyncRemote -ComputerName 'aadconnect01' -PolicyType Initial -UseKerberos -WhatIf
# HTTPS WinRM (5986) with transcript in Logs
Invoke-AADSyncRemote -ComputerName 'aadconnect01.company.com' -Port 5986 -EnableTranscriptLoads the configs from config.json manually if needed
Get-TechToolboxConfigRemotely set initial and maximum sizes of the pagefile in MB.
# Usage of defaults (grabbed from config.json)
Set-PageFileSize -ComputerName "Server01.domain.local"
# Set via parameters during script call
Set-PageFileSize -ComputerName "Server01.domain.local" -InitialSize 4096 -MaximumSize 8192 -Path "C:\pagefile.sys"Recurses through user folders and removes files older than the cutoffyear
# Invokes downloads cleanup on a remote workstation
Invoke-DownloadsCleanup -ComputerName "Workstation01"
# Invoke locally
Invoke-DownloadsCleanup -Local -CutoffYear 2020This function gathers Network related details of a subnet. It can be run locally or remote via PSRemoting.
# Local subnet usage example
Invoke-SubnetScan -CIDR "192.168.1.0/24"
# Remote invocation example
Invoke-SubnetScan -CIDR "10.0.0.0/16" -ComputerName "RemoteHost"This will utilize an impersionation helper to test directory or file access using a supplied set of credentials
# Test share access as:
Test-PathAs -Path "\\server\share\installer.msi" -Credential $credUtilizes robocopy to copy data from one dir to another
# Auto prompting for source and destination
Copy-Directory
# Usage with params
Copy-Directory -Source "\\File01\Share\HR" -DestinationRoot "\\Mgmt01\Archive"A small collection of commonly used built in system repair tools. These can be run locally with -Local switch; remote with -ComputerName.
# Run locally
Invoke-SystemRepair -RestoreHealth -Local
# Run remote
Invoke-SystemRepair -RestoreHealth -ComputerName "Client01" -Credential (Get-Credential)This tool retrieves Windows Activation info either locally or on a remote client
# Run locally
Get-WindowsActivationInfo
# Run Remote
Get-WindowsActivationInfo -ComputerName "RemotePC" -Credential (Get-Credential)A module for resetting winodws update components locally or on a remote host
# Run locally
Reset-WindowsUpdateComponents
# Reset on a remote host
Reset-WindowsUpdateComponents -ComputerName "RemotePC" -Credential (Get-Credential)A simple tool to set SMTP: address for a user's AD Object
# Usage:
Set-ProxyAddress -Username "jdoe" -ProxyAddress "jdoe@example.com"Automated ADUser creation with -TemplateIdentity "user_to_copy_from" support
# Example:
New-OnPremUserFromTemplate -TemplateIdentity "jdoe" -GivenName "John" -Surname "Smith" -DisplayName "John Smith" -TargetOU "OU=Users,DC=example,DC=com"Gets details about a system, local or remote, and outputs to console and eports to CSV
# Local and remote support
Get-SystemSnapshot -ComputerName SERVER01 -Credential (Get-Credential)This grabs several values assigned to a user (input at runtime) and returns to console
# EXAMPLE
Search-User -Identity "user@example.com"This routine will disable -Identity in on-prem AD with some other tasks
# Example usage
Disable-User -Identity 'jdoe' -IncludeEXO -IncludeTeamsThis tool cleans up the spooler and removes installed print queues, optional params include driver removal and/or ports
# Example usage
Remove-Printers -IncludePorts -IncludeDrivers -Force -AllUsers -PassThru- Structure:
Private/(helpers),Public/(exported),Config/(json),TechToolbox.psm1(loader),TechToolbox.psd1(manifest). - One function per file with matching names for clean auto-export.
- Advanced Functions:
[CmdletBinding()], validated parameters,ShouldProcessfor state changes. - Logging: centralized
Write-Logusing streams (Write-Information,Write-Warning,Write-Error) and optional file logging via config. - Config cache:
Get-TechToolboxConfigreturns a cached object; addReset-TechToolboxConfigif you need runtime reloads. - Cross-platform: Target is Windows; Chromium paths, EXO/Purview cmdlets assume Windows/EXO contexts.
- Module import: Ensure
TechToolbox.psd1points toTechToolbox.psm1and PowerShell 7+. - Permissions:
- Remote inventory / AADSync require WinRM and appropriate rights on target hosts.
- Purview workflows require eDiscovery roles and ExchangeOnlineManagement module.
- Message trace: V2 retention limits apply; widen the window or verify Message-ID.
- Battery report:
powercfgmust be present; run PowerShell as admin if report generation fails. - Logging to file: Confirm
Paths.LogDirectoryexists orEnableFileLoggingis false.
# Analyzer (configurable rules)
Invoke-ScriptAnalyzer -Path .\TechToolbox -Recurse -Severity Error,Warning
# Smoke tests (dry runs)
Clear-BrowserProfileData -WhatIf
Get-RemoteInstalledSoftware -ComputerName srv01 -WhatIf
Invoke-PurviewPurge -UserPrincipalName you@company.com -CaseName Case-001 -SearchName Search-001 -WhatIf
Get-MessageTrace -MessageId '<test@company.com>' -WhatIf
Get-BatteryHealth -WhatIf
Invoke-AADSyncRemote -ComputerName aadconnect01 -PolicyType Delta -WhatIfAuthor: Dan Damit
License: Internal use
Version: 0.3.0