tocOn this page 7 sections
AI coding agents are command-line tools that read your repository, edit files and run shell commands for you. If your workspace is a Windows VPS, you have to decide where the agent runs: directly in Windows, using PowerShell or a Windows build of Git Bash, or inside the Windows Subsystem for Linux (WSL). Both can work. Which one suits you depends on your codebase, your VPS and how much the agent should be able to touch.
What the agent needs from its environment
Most coding agents need the same few things:
- A shell to run commands in. The agent runs builds, tests, linters and git. If its prompts and tooling assume a POSIX shell, it may produce
grep,sedand&&chains that don't translate cleanly to PowerShell. - A runtime. Many agents ship as Node.js or Python packages, or as a single binary. Support for native Windows differs from tool to tool, so check the agent's own documentation before you choose.
- Fast file access. Agents scan, search and rewrite many files, so slow disk I/O makes every step slower.
- Network access to the model API and to package registries.
When native Windows is the better fit
Run the agent natively when the code you're working on is Windows code: .NET and ASP.NET projects, PowerShell modules, IIS configuration, Windows services, or anything that builds with MSBuild or Visual Studio tooling. In that case the agent has to call dotnet, msbuild or Pester directly. Running it from Linux and reaching back into Windows only adds a layer that can break.
Native also wins when your VPS can't run WSL 2 at all (see below). A few things help:
- Install Git for Windows. Many agents can use its bundled Bash, which smooths over a lot of POSIX assumptions.
- Set
git config --global core.autocrlfon purpose, so the agent doesn't create diffs that only change line endings. - If you'll script the agent, run PowerShell 7 rather than Windows PowerShell 5.1. Its behaviour is more consistent across platforms.
For a broader dev setup on Windows, see our guide to a Windows VPS for development and testing.
When WSL is the better fit
Use WSL when the project targets Linux: web backends deployed to Linux containers, Python data tooling, shell-heavy repos, or anything with a Makefile that assumes GNU utilities. The agent then works in the same kind of environment your CI and production servers use, so the commands it writes and tests are the ones that will actually run there.
The VPS catch: WSL 2 needs virtualization
WSL 2 runs a lightweight virtual machine. On a VPS, your Windows guest is already a virtual machine, so WSL 2 only works if the host exposes nested virtualization to it. If it doesn't, installing a distribution typically fails with an error saying virtualization isn't enabled. Check from an elevated PowerShell session over RDP:
wsl --status
wsl --list --verbose
Get-ComputerInfo -Property HyperV*
If nested virtualization isn't available, you have two fallbacks. WSL 1 translates Linux system calls instead of running a VM, so it doesn't need nested virtualization, but it's less compatible and slower on file-heavy work. You can also ask support whether your plan can expose virtualization extensions. Note that older Windows Server releases only support WSL 1, so check what your edition offers before you plan around WSL 2.
On a supported system, installing is a single command followed by a reboot:
wsl --install -d Ubuntu
Keep the repo on the Linux side
WSL performance depends on where the files live. A repo under /mnt/c/... is reached across the Windows–Linux boundary, and agents that search the tree or run test suites slow down noticeably. Clone into your Linux home directory instead (for example ~/projects) and run the agent there. You can still open those files from Windows through the \\wsl$ path.
Cap WSL's memory
By default the WSL 2 VM can claim a large share of the VPS's RAM, leaving less for IIS, SQL Server or trading terminals. Create %UserProfile%\.wslconfig to set limits:
[wsl2]
memory=4GB
processors=2
Run wsl --shutdown to apply the change.
Isolation: neither option is a real sandbox
People often assume WSL keeps the agent contained. It doesn't, by default. Windows drives are mounted under /mnt, and interop lets Linux processes start Windows executables. An agent with a careless or hijacked instruction can still reach your Windows files. To tighten a distribution used only for agent work, edit /etc/wsl.conf inside it:
[automount]
enabled = false
[interop]
enabled = false
appendWindowsPath = false
Then run wsl --shutdown and start the distribution again. That cuts off the easy routes back into Windows. More generally:
- Run the agent as a non-administrator user, on Windows and inside WSL.
- Keep production secrets, RDP credentials and the agent's API keys apart. Don't leave a
.envfull of live credentials where the agent can read it. - Keep the agent's approval prompts on for destructive commands, especially on a server that also runs live services.
Prompt injection through files, issues or web content is a real risk once an agent can run commands. Our post on hardening local LLMs against prompt injection covers the same mindset in more depth.
Long-running agents over RDP
If you disconnect from RDP instead of signing out, your session stays alive and so do the agent's processes, inside or outside WSL. Signing out ends them. For unattended or recurring agent jobs, start them from Task Scheduler instead of an interactive window, and give them a lower priority so they don't starve production workloads. See setting scheduled task priority for how.
A third option: a separate Linux VPS
If your work is mostly Linux-targeted and your Windows VPS also runs things you care about, consider giving the agent its own small Linux VPS reached over SSH. You get no nested-virtualization questions, no memory competition with Windows services, and a clean boundary: if the agent breaks something, it breaks a disposable box.
Quick decision guide
- Windows-targeted code (.NET, PowerShell, IIS): run natively.
- Linux-targeted code and WSL 2 works on your VPS: use WSL, keep the repo in the Linux filesystem, and cap memory.
- Linux-targeted code but no nested virtualization: try WSL 1 for light work, or move the agent to a Linux VPS.
- Agent on a server running production services: whichever you choose, restrict its access and run it as a non-admin user.
Run this on your own Windows VPS
Get a Windows VPS from WindowsVPS in about 60 seconds, with full Administrator access over RDP, NVMe storage and the Windows license included.
Written by the WindowsVPS Team
We run Windows Server VPS hosting and write these guides from the same setups our customers use: RDP, PowerShell, trading terminals and always-on bots. Questions about a guide? Contact us.