Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

WinslopFix

PowerShell Gallery PowerShell Gallery Downloads License: MIT

Manages WorkloadsSessionHost memory consumption on Windows 11 Copilot+ PCs.

Microsoft's Copilot+ architecture pre-loads AI models into RAM via WorkloadsSessionHost.exe — often spawning 5–9 instances that collectively consume 2–8GB of memory, even when no AI features are in use. On systems where every megabyte counts, this is unacceptable.

WinslopFix provides intelligent, memory-threshold-based process management, granular Copilot AI feature controls, and silent RMM-ready deployment — all packaged as a proper PowerShell module.

Originally inspired by WorkloadManager by Dante/SafeAutentic. Refactored from scratch with proper module architecture, structured output, comprehensive help, and PSGallery compliance.


Installation

PowerShell Gallery (Recommended)

Install-Module -Name WinslopFix -Scope CurrentUser

Manual

# Clone or download to a PSModulePath directory
git clone https://github.com/DailenG/WinslopFix.git "$env:USERPROFILE\Documents\PowerShell\Modules\WinslopFix"
Import-Module WinslopFix

Quick Start

# Import the module
Import-Module WinslopFix

# See what's running and how much memory it's consuming
Get-WorkloadSessionStatus

# Preview what would be killed (dry run)
Stop-WorkloadSession -WhatIf

# Kill processes exceeding 512MB (default threshold)
Stop-WorkloadSession -Confirm:$false

# Install as a persistent, silent background monitor (SYSTEM, no UAC prompts)
Install-WinslopFix

# Install AND disable all Copilot AI features
Install-WinslopFix -DisableAIFeatures

Functions

Function Description
Get-WorkloadSessionStatus Returns structured metrics for all WorkloadsSessionHost instances
Stop-WorkloadSession Terminates processes using configurable strategy (MemoryThreshold, Timer, All)
Start-WinslopFix Starts the persistent monitoring loop (called by the Scheduled Task)
Install-WinslopFix Deploys the module and creates a SYSTEM-level Scheduled Task
Uninstall-WinslopFix Removes the Scheduled Task, deployed files, and Event Log source
Get-WinslopFixLog Queries Windows Event Log entries with category filtering
Disable-CopilotAIFeature Disables Recall, Click to Do, and/or Windows AI Fabric Service
Enable-CopilotAIFeature Re-enables previously disabled AI features

Termination Strategies

MemoryThreshold (Default)

Kills processes exceeding a per-process threshold (default: 512MB) or when aggregate memory across all instances exceeds an aggregate threshold (default: 2GB).

Note on Accuracy: WinslopFix evaluates PrivateMemorySize64 (Private Bytes) instead of WorkingSet64. This ensures we only kill instances that are truly hoarding exclusive memory, ignoring large AI models that are safely mapped into shared memory. This is the intelligent approach — processes that aren't consuming problematic exclusive memory are left alone.

Stop-WorkloadSession -Strategy MemoryThreshold -PerProcessThresholdMB 256 -AggregateThresholdMB 1024

Timer

Kills processes that have been running longer than a specified duration. This mirrors the original SafeAutentic behavior for environments that prefer time-based management.

Stop-WorkloadSession -Strategy Timer -TimerSeconds 120

All

Immediately terminates every WorkloadsSessionHost instance. Use sparingly.

Stop-WorkloadSession -Strategy All -Confirm:$false

Copilot AI Feature Management

Granular control over Windows AI features without touching the monitor:

# Disable just Recall
Disable-CopilotAIFeature -Feature Recall

# Disable everything
Disable-CopilotAIFeature -Feature All

# Re-enable Click to Do only
Enable-CopilotAIFeature -Feature ClickToDo

# Preview what would change
Disable-CopilotAIFeature -Feature All -WhatIf

Supported Features

Feature What It Controls
Recall Registry policies, ScreenshotIndexerService, Recall/Snapshot scheduled tasks
ClickToDo DisableClickToDo registry policy
WindowsAI WSAIFabricSvc service, all Windows AI scheduled tasks
All All of the above

RMM Deployment

One-Shot (Run Once via RMM Script)

Install-Module WinslopFix -Force -Scope AllUsers
Import-Module WinslopFix
Install-WinslopFix -DisableAIFeatures -Force

Run-Once Without Installing Persistent Monitor

Import-Module WinslopFix
Start-WinslopFix -RunOnce

Check Status Remotely

Import-Module WinslopFix
Get-WorkloadSessionStatus | ConvertTo-Json

Configuration

The monitor loads configuration from a JSON file. Resolution order:

  1. Explicit -ConfigPath parameter
  2. $env:ProgramData\WinslopFix\config.json (deployed config)
  3. Bundled Config\DefaultConfig.json
  4. Hardcoded safe defaults

Default Configuration

{
    "Strategy": "MemoryThreshold",
    "PerProcessThresholdMB": 512,
    "AggregateThresholdMB": 2048,
    "TimerSeconds": 60,
    "ScanIntervalSeconds": 10,
    "ProcessName": "WorkloadsSessionHost",
    "EventLogSource": "WinslopFix",
    "EventLogName": "Application"
}

To customize, copy this to C:\ProgramData\WinslopFix\config.json and edit as needed. The monitor will pick up changes on next restart.


Event Log

All operations are logged to the Windows Application Event Log under the WinslopFix source.

# View recent activity
Get-WinslopFixLog -Newest 20

# View only kills
Get-WinslopFixLog -Category Kills

# View errors from the last hour
Get-WinslopFixLog -Category Errors -After (Get-Date).AddHours(-1)

Event ID Schema

Range Category Description
1000-1999 Lifecycle Monitor start/stop, config loaded
2000-2999 Detection New process detected, natural exit
3000-3999 Action Process terminated (by strategy)
4000-4999 Policy AI feature enabled/disabled
9000-9999 Error Failures and exceptions

Differences from Original SafeAutentic Version

Aspect Original WinslopFix Module
Kill strategy Blind 60-second timer Memory-threshold (configurable)
Auto-start HKCU:\Run (UAC prompt every boot) SYSTEM Scheduled Task (silent)
Error handling Empty catch {} blocks Structured errors, Event Log, warnings
Structure 3 loose .ps1 files Proper .psd1 + .psm1 module
Output Write-Host only Structured PSCustomObject pipeline output
AI controls All-or-nothing (baked into installer) Granular per-feature targeting
Safety No WhatIf/Confirm Full SupportsShouldProcess
Uninstall Kills ALL PowerShell processes Targeted Scheduled Task removal
Language Spanish only English with full comment-based help
Tests None Pester + PSScriptAnalyzer

Requirements

  • Windows 11 (24H2 / 25H2) on Copilot+ PC hardware
  • PowerShell 5.1 or PowerShell 7+
  • Administrator privileges for install/uninstall and AI feature management
  • No external module dependencies

License

MIT License


Attribution

Originally inspired by WorkloadManager by Dante/SafeAutentic. This module is a complete rewrite maintaining the same objective: keep WorkloadsSessionHost.exe from consuming unreasonable system resources on Copilot+ PCs.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages