A unified, menu-driven PowerShell application for Windows Server and Client management tasks.
iex (irm https://raw.githubusercontent.com/GonzFC/WinSrvManagementScripts/main/install.ps1)One command to install and run the complete Windows management suite!
- Disk Space Reclamation: Comprehensive cleanup of WinSxS, Windows Update cache, Delivery Optimization, TEMP folders, and inactive user profiles
- UI Optimization: Disable backgrounds and animations across all users
- Tailscale VPN: Automated installation and configuration with unattended mode
- Jump Desktop Connect: Remote desktop solution installer with RDP tunneling
- WSB Reporter (option 16): pushes this server's Windows Server Backup status to a central "xscp" runner's ingest endpoint on a schedule, so backup health for the whole fleet shows up in one dashboard with alerts. Push-based (outbound HTTP + Bearer token over the VPN) - no inbound WinRM and no Windows credentials stored off-box.
- Enable WinRM Management (option 15): turns on WinRM hardened for remote control from a management host (Basic auth off, unencrypted off, Negotiate/Kerberos, optional self-signed HTTPS listener, firewall scoped to your xscp/announcer IPs).
- Edge Browser Hardening: Privacy-focused configuration with about:blank homepage, DuckDuckGo search, disabled MSN feed, and minimal tracking
- Desktop Info Widget: System and network information overlay on desktop, installed for every user on the server (each user's own session, at logon); shows the toolbox and widget versions plus the last auto-update, and installs a daily SYSTEM task ("WinToolbox Auto Update") that keeps the toolbox and the widget current
- TLS/PowerShell Upgrade: Modernize legacy Windows systems (2008R2/2012/2012R2) with TLS 1.2, .NET 4.8, and PowerShell 5.1
- Virtualization Guest Tools: Automated installation of XCP-ng Windows PV Tools or XenServer/Citrix Hypervisor VM Tools
- XCP-ng PV Tools v9.1.100 (recommended for XCP-ng hosts, requires Windows 10 1607+/Server 2016+)
- XenServer/Citrix VM Tools (compatible with older Windows versions)
- Network Speed Test: Peer-to-peer bidirectional bandwidth testing using iperf3
- Automatic iperf3 installation (no Visual C++ runtime required)
- Upload and download measured separately with 4 parallel TCP streams
- Test durations: Quick (5s), Standard (10s), Extended (30s)
- Configure Windows Update (option 10): Stable, predictable security patching
- Sunday 4 AM maintenance window
- Critical security updates only, no driver or feature updates
- 365-day feature update deferral
- Disable Windows Updates (option 11): Full manual control
- Disables all automatic update downloads and installations
- Optional: completely disable the wuauserv service
- Updates remain available for manual installation
- PowerShell: Version 5.1 or higher
- Privileges: Administrator rights required
- Operating System: Windows Server 2012 R2+ or Windows 10/11
Open PowerShell as Administrator and run:
iex (irm https://raw.githubusercontent.com/GonzFC/WinSrvManagementScripts/main/install.ps1)Or the alternative syntax:
irm https://raw.githubusercontent.com/GonzFC/WinSrvManagementScripts/main/install.ps1 | iexThis will:
- Automatically elevate to Administrator if needed
- Download the latest version from GitHub
- Install to
C:\ProgramData\WinToolbox - Create a Start Menu shortcut
- Offer to launch the toolbox immediately
- Clone or download this repository
- Ensure the following structure exists:
WinSrvManagementScripts/ ├── WinToolbox.ps1 # Main launcher ├── modules/ │ ├── Common.psm1 │ ├── SystemOptimization.psm1 │ ├── SecurityPrivacy.psm1 │ ├── RemoteAccess.psm1 │ └── Maintenance.psm1 └── README.md - Run
WinToolbox.ps1as Administrator
After installation, you can run the toolbox in several ways:
From Start Menu:
- Search for "Windows Management Toolbox" and click the shortcut
From PowerShell:
cd C:\ProgramData\WinToolbox
.\WinToolbox.ps1Or if you cloned manually:
cd C:\Path\To\WinSrvManagementScripts
.\WinToolbox.ps1Navigate through the menu using number keys:
Windows Management Toolbox v1.3.0
==================================
System Optimization:
[1] Reclaim Disk Space
[2] Disable Backgrounds and Animations
Remote Access:
[3] Install Tailscale VPN
[4] Install Jump Desktop Connect
Security & Privacy:
[5] Harden Microsoft Edge
Maintenance:
[6] Install Desktop Info Widget
[7] Upgrade TLS and PowerShell
[8] Install Virtualization Tools (XCP-ng / XenServer)
Performance & Updates:
[9] Network Speed Test (iperf3)
[10] Configure Windows Update (Stable Security Patching)
[11] Disable Windows Updates (Manual Control Only)
Monitoring & Management:
[15] Enable WinRM Management (remote control from xscp)
[16] Install Backup Reporter (WSB status -> xscp)
System:
[12] View System Information
[13] View Logs
[14] Check for Updates
[Q] Quit
Every menu option can run straight from PowerShell, without opening the menu. Nothing prompts, so it works in scripts, scheduled tasks, RMM tools and remote sessions:
cd C:\ProgramData\WinToolbox
.\WinToolbox.ps1 -Run <Action> [parameters]<Action>is the action name or its menu number (-Run DesktopInfoand-Run 6are the same)..\WinToolbox.ps1 -Run Listprints every action with its parameters.- Run from an elevated PowerShell (Administrator).
SystemInfoandLogsare the exceptions. - Exit code:
0= success,1= failure. Every run is logged inC:\VLABS\Maintenance\.
From cmd.exe, a scheduled task or an RMM tool, call PowerShell explicitly:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\ProgramData\WinToolbox\WinToolbox.ps1" -Run DesktopInfoOn a remote server over WinRM:
Invoke-Command -ComputerName SRV01 -ScriptBlock {
& 'C:\ProgramData\WinToolbox\WinToolbox.ps1' -Run WindowsUpdateConfig
}| # | Action | What it does | Example |
|---|---|---|---|
| 1 | DiskCleanup |
Reclaim disk space (WinSxS, updates, TEMP). Inactive profiles are deleted only with -DeleteProfiles (no per-profile question). Options: -DaysInactive, -DeepComponentCleanup, -Schedule |
.\WinToolbox.ps1 -Run DiskCleanup -DaysInactive 60 -DeleteProfiles |
| 2 | DisableAnimations |
Disable backgrounds and animations for all users | .\WinToolbox.ps1 -Run DisableAnimations |
| 3 | Tailscale |
Install Tailscale. Options: -AuthKey, -LoginServer, -AcceptRoutes, -AdvertiseRoutes, -AcceptDNS, -Hostname, -Operator |
.\WinToolbox.ps1 -Run Tailscale -AuthKey tskey-abc123 -AcceptRoutes |
| 4 | JumpDesktop |
Install Jump Desktop Connect. Requires -ConnectCode |
.\WinToolbox.ps1 -Run JumpDesktop -ConnectCode 123456 |
| 5 | EdgeHardening |
Harden Microsoft Edge (privacy, clean homepage) | .\WinToolbox.ps1 -Run EdgeHardening |
| 6 | DesktopInfo |
Install/update the Desktop Info Widget for all users + the daily toolbox auto-update | .\WinToolbox.ps1 -Run DesktopInfo |
| 7 | TlsUpgrade |
Upgrade TLS 1.2, .NET and PowerShell on legacy systems. Option: -UpdateRoots |
.\WinToolbox.ps1 -Run TlsUpgrade -UpdateRoots |
| 8 | VMTools |
Install VM guest tools. Requires -Platform XCPng or -Platform XenServer. Options: -NoReboot, -DisableWUDrivers |
.\WinToolbox.ps1 -Run VMTools -Platform XenServer -NoReboot |
| 9 | SpeedTest |
iperf3 test against a peer. Requires -Peer. Option: -Duration 5, 10 (default) or 30 |
.\WinToolbox.ps1 -Run SpeedTest -Peer 10.0.0.5 -Duration 30 |
| 10 | WindowsUpdateConfig |
Windows Update: Sundays 4 AM, security only, no drivers, reboot only then | .\WinToolbox.ps1 -Run WindowsUpdateConfig |
| 11 | DisableWindowsUpdates |
Disable automatic updates (manual only). Option: -DisableService also stops/disables the service |
.\WinToolbox.ps1 -Run DisableWindowsUpdates -DisableService |
| 12 | SystemInfo |
Print OS, CPU, RAM, free space | .\WinToolbox.ps1 -Run SystemInfo |
| 13 | Logs |
List the log files | .\WinToolbox.ps1 -Run Logs |
| 14 | Update |
Update the toolbox now if a newer version exists. Option: -Force reinstalls anyway |
.\WinToolbox.ps1 -Run Update |
| 15 | WinRM |
Enable hardened WinRM. Options: -AllowedSource (comma-separated IPs/CIDRs), -Https, -DisableHttp |
.\WinToolbox.ps1 -Run WinRM -AllowedSource 192.168.1.240,192.168.1.252 |
| 16 | BackupReporter |
Install the WSB Reporter. Requires -XscpUrl and -Token. Option: -IntervalMinutes |
.\WinToolbox.ps1 -Run BackupReporter -XscpUrl http://xscp.example:8899/ingest/wsb -Token abc |
Each tool also exists as a standalone script in the install folder, which runs without the toolbox (run as Administrator):
| Script | Command line |
|---|---|
WinSrv - Reclaim Disk Space.ps1 |
& '.\WinSrv - Reclaim Disk Space.ps1' -DaysInactive 30 [-DeepComponentCleanup] [-SkipProfileDeletion] [-Schedule] |
WinSrv - Disable Backgrounds and Animations.ps1 |
& '.\WinSrv - Disable Backgrounds and Animations.ps1' |
WinSrv - Tailscale Installer.ps1 |
& '.\WinSrv - Tailscale Installer.ps1' -AuthKey tskey-abc123 [-AcceptRoutes] [-AdvertiseRoutes 10.0.0.0/24] [-AcceptDNS] [-Hostname SRV01] |
WinSrv - Jump Desktop Connect Installer.ps1 |
Asks for the connect code; for no prompts use -Run JumpDesktop -ConnectCode ... |
WinSrv - Microsoft Edge Clean.ps1 |
& '.\WinSrv - Microsoft Edge Clean.ps1' |
WinSrv - Desktop Info.ps1 |
& '.\WinSrv - Desktop Info.ps1' (all users when run as Administrator) |
WinSrv - Toolbox Auto Update.ps1 |
& '.\WinSrv - Toolbox Auto Update.ps1' checks/updates now; -Install registers the daily task; -Uninstall removes it; -Force reinstalls |
WinSrv - 2012R2 SSL TLS Upgrader.ps1 |
& '.\WinSrv - 2012R2 SSL TLS Upgrader.ps1' [-UpdateRoots] |
WinSrv - XenSrv Tools Install.ps1 |
Interactive; for no prompts use -Run VMTools -Platform ... |
WinSrv - Windows Update Configuration.ps1 |
Asks to confirm; for no prompts use -Run WindowsUpdateConfig |
WinSrv - Disable Windows Updates.ps1 |
& '.\WinSrv - Disable Windows Updates.ps1' -Unattended [-DisableService] |
To update to the latest version, simply run the one-liner installer again:
iex (irm https://raw.githubusercontent.com/GonzFC/WinSrvManagementScripts/main/install.ps1)This will download and replace the existing installation with the latest version.
Without the menu: .\WinToolbox.ps1 -Run Update. Installing the Desktop Info
Widget also registers a daily SYSTEM task ("WinToolbox Auto Update") that does
this automatically.
The disk cleanup function can create a weekly scheduled task:
.\WinToolbox.ps1
# Select: 1 (System Optimization) -> 1 (Reclaim Disk Space)
# Answer "Yes" when prompted to create scheduled taskOr run cleanup directly (see Command-Line Usage):
.\WinToolbox.ps1 -Run DiskCleanup -DaysInactive 30 -DeepComponentCleanup-AutoCleanup is what the weekly scheduled task itself calls.
All operations are logged to: C:\VLABS\Maintenance\
View logs from within the toolbox:
- Main Menu -> 6 (View Logs)
The toolbox uses a modular architecture for easy maintenance:
- Common.psm1: Shared utilities (logging, admin checks, OS detection, UI helpers)
- SystemOptimization.psm1: Disk cleanup and UI optimization functions
- SecurityPrivacy.psm1: Browser hardening and privacy configurations
- RemoteAccess.psm1: Remote access solution installers (Tailscale, Jump Desktop, WinRM)
- Maintenance.psm1: System maintenance and upgrade tools
- Monitoring.psm1: WSB Reporter - pushes Windows Server Backup status to the xscp runner
- Easy to maintain and update individual components
- Clear separation of concerns
- Better version control with granular change tracking
- Reusable modules for other scripts
- Simplified testing
- Administrator Check: Automatically prompts for elevation
- PowerShell Version Check: Ensures compatibility
- Profile Deletion Confirmation: Individual prompts for each inactive profile
- Dry-run Estimation: Disk cleanup estimates gains before execution
- Minimum Gain Threshold: Skips cleanup if estimated gain < 5 GB
- Comprehensive Logging: All operations logged with timestamps
The standalone scripts (command-line usage: see Standalone scripts):
WinSrv - Desktop Info.ps1WinSrv - Toolbox Auto Update.ps1(daily toolbox/widget updater;-Installregisters the task)WinSrv - 2012R2 SSL TLS Upgrader.ps1WinSrv - Jump Desktop Connect Installer.ps1WinSrv - Disable Backgrounds and Animations.ps1WinSrv - Microsoft Edge Clean.ps1WinSrv - Tailscale Installer.ps1WinSrv - Reclaim Disk Space.ps1WinSrv - XenSrv Tools Install.ps1WinSrv - Windows Update Configuration.ps1WinSrv - Disable Windows Updates.ps1
The virtualization tools installer now supports both XCP-ng and XenServer:
-
XCP-ng Windows PV Tools v9.1.100 (Primary Option)
- Latest stable release with digitally signed drivers
- Improved performance and features for XCP-ng hosts
- Requires Windows 10 1607 / Windows Server 2016 or newer
- Open-source and community-supported
- Includes security fixes for XSA-468 vulnerabilities
-
XenServer/Citrix Hypervisor VM Tools (Legacy Option)
- Official Citrix management agent
- Compatible with older Windows versions
- Stable and widely deployed
The installer automatically detects OS compatibility and recommends the appropriate option.
The Edge hardening script now properly disables the MSN home page and news feed on Windows 10/11 clients by:
- Setting
NewTabPageSetFeedType = 0(disables MSN feed) - Setting
NewTabPageContentEnabled = 0(disables new tab content) - Setting
NewTabPageQuickLinksEnabled = 0(disables quick links) - Setting
ShowHomeButton = 0(hides home button) - Setting
EdgeAssetDeliveryServiceEnabled = 0(disables news/ads delivery)
If you encounter "function not recognized" errors, this is typically due to PowerShell module loading challenges on Windows Server 2012 R2 / 2016 with PowerShell 5.1.
Symptoms:
- Functions like
Show-Menu,Initialize-Logging, orTest-Administratornot recognized - Modules appear to load successfully but functions aren't available
- Script cycles with "Invalid selection" errors
Root Causes Identified:
-
Import-Module with -Scope Global doesn't work reliably when scripts are launched via
Start-Process- PowerShell 5.1 creates module session state isolation
- Functions exist in module scope but aren't accessible from script scope
- This is a known PowerShell 5.1 limitation
-
Dot-sourcing (.psm1 files) can fail due to Windows file associations
- .psm1 files may open in Notepad instead of executing
- Execution policy or file association issues prevent proper loading
-
Export-ModuleMember conflicts with dot-sourcing
- When dot-sourcing, Export-ModuleMember removes functions instead of exporting them
- This command only works correctly with Import-Module
-
Cross-module dependencies cause empty path errors
$PSScriptRootis undefined when using Invoke-Expression- Modules trying to import other modules fail with empty string path errors
Solution Implemented (v1.0.5):
The toolbox uses Invoke-Expression to load module content:
$moduleContent = Get-Content -Path $moduleFile -Raw
Invoke-Expression $moduleContentWhy this works:
- Explicitly reads file content and executes in current scope
- Bypasses file association and execution policy issues
- No module session state isolation
- Functions remain available throughout script execution
Key implementation details:
$Global:ToolboxRootprovides script directory to modules (replaces$PSScriptRoot)- All modules loaded in dependency order (Common first)
- No cross-module Import-Module statements needed
- Export-ModuleMember commented out (not needed with Invoke-Expression)
Symptoms (after editing on macOS):
- "Missing string terminator"
- "Missing closing brace"
- "Output stream already redirected"
- All errors cascade from a single line far above the actual problem
Root Cause:
Scripts saved as UTF-8 without BOM on macOS are read by PowerShell 5.1 on Windows
as Windows-1252. The UTF-8 byte sequence for checkmark U+2713 (0xE2 0x9C 0x93)
decodes in Windows-1252 as three characters, the last being a curly left double-quote
(0x93). That stray quote terminates any string it lands inside, producing all the above
cascading errors. The error message points to a line far below the Unicode character,
making it appear unrelated.
Rule: Files without a UTF-8 BOM must contain only ASCII characters (codepoints
0-127). Use [OK], [X], [!] instead of checkmark, ballot X, warning sign.
Check for Unicode in your files:
# On macOS/Linux
python3 -c "
import glob
for f in glob.glob('**/*.ps1', recursive=True) + glob.glob('**/*.psm1', recursive=True):
chars = {repr(c) for line in open(f, encoding='utf-8') for c in line if ord(c) > 127}
if chars: print(f, chars)
"Files with \ufeff (BOM) are safe - PowerShell 5.1 will correctly read them as UTF-8
and Unicode symbols will display properly.
Problem: Installer fails to download
- Solution: Ensure TLS 1.2 is enabled:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - Alternative: Use Git clone method instead of ZIP download
Problem: Files blocked by execution policy
- Solution: The installer automatically runs
Unblock-Fileon all downloaded files - Manual fix:
Get-ChildItem C:\ProgramData\WinToolbox -Recurse | Unblock-File
See CHANGELOG.md for detailed version history and changes.
When adding new functionality:
- Add functions to the appropriate module in
modules/ - Update
WinToolbox.ps1to add menu entries - Use the
Write-LogMessagefunction for all logging - Follow the existing code style and error handling patterns
- Important: Do not use
$PSScriptRoot- use$Global:ToolboxRootinstead - Important: Do not add
Import-Modulestatements between modules - Important: Do not use
Export-ModuleMemberin .psm1 files - Important: Use only ASCII characters (0-127) in
.ps1and.psm1files that do NOT have a UTF-8 BOM. Unicode symbols (checkmark,arrow,bullet) will corrupt string parsing on Windows PowerShell 5.1. Use[OK],[X],[!],->instead.
Module Loading Architecture:
- Modules loaded with
Invoke-Expression(Get-Content + Invoke-Expression) - All modules loaded in WinToolbox.ps1 in dependency order
- Common.psm1 must be first (provides shared functions)
$Global:ToolboxRootavailable to all modules for path references
Testing Locally:
# Run directly without installer
cd C:\Path\To\WinSrvManagementScripts
.\WinToolbox.ps1
# Test specific module functionality
.\WinToolbox.ps1 -AutoCleanup -DaysInactive 30Internal use - IT Infrastructure Team
For issues or questions, check the logs in C:\VLABS\Maintenance\ or contact the IT Infrastructure Team.