Why run Claude Code on a server?
Claude Code is an AI coding assistant that runs on your machine. It can read your project, edit files and run commands. Normally Claude Code stops when your laptop goes to sleep, loses Wi-Fi or gets closed for the night. But if you want it to run in the background or work on projects continuously, it is possible.
Moving it to a VPS (a virtual private server) can solve this problem. The server stays on around the clock, so Claude can keep working on a long task while you are away. With Remote Control, you can check on it and give it new instructions from any browser.
This guide shows you how to set it up on a Windows VPS in about 20 minutes. Every command is ready to copy and paste, and there is a one-click setup script if you would rather not type anything at all.
In this guide you will:
- Decide whether Windows or Linux suits you better
- Install Git, VS Code and Claude Code (one script or step by step)
- Start a Remote-Control session you can reach from your other devices.
- Keep it running after you disconnect, and after a reboot
- (Optional) Schedule Claude to run jobs automatically
Windows VPS or Linux VPS?
Both work well, and Claude Code runs natively on each. The right choice depends on how you like to work and what you are building.
| Windows VPS | Linux VPS | |
|---|---|---|
| How you connect | Remote Desktop: a full desktop with mouse and windows | SSH: a text terminal (a desktop is possible but extra work) |
| VS Code | Runs directly on the server, just like on your PC | Usually run on your PC and connected with Remote-SSH |
| Learning curve | Familiar if you already use Windows | Easier if you already know the command line |
| Server resources | Needs more RAM for the desktop; 8 GB is comfortable | Very light; runs well on smaller plans |
| Cost | Includes a Windows licence, so often a little more | Usually the cheapest option |
| Best for building | .NET, C#, PowerShell, IIS, SQL Server, Windows apps, Excel/Office automation | Web apps, Python, Node.js, Docker, Linux servers |
| Testing in a browser | Open Edge or Chrome on the server and look at the result | Needs a headless browser or extra setup |
| Sandboxing | Not supported on native Windows (available through WSL 2) | Supported |
| Tutorials online | Fewer, but growing | Most Claude Code guides assume Linux or macOS |
Choose Windows if you want to see and click around on your server, you prefer working in VS Code with a mouse, or your project targets Windows (.NET, IIS, desktop tools, trading platforms such as MT4/MT5).
Choose Linux if you are comfortable in a terminal, want the smallest and cheapest server, or deploy mostly to Linux in production.
You may not need a server at all if your code lives on GitHub and you only need Claude to work on it in the background. Claude Code on the web runs sessions in Anthropic’s cloud, and routines can run tasks on a schedule. A VPS makes more sense when you want a persistent machine of your own: your own tools installed, local databases, files that stay put, or software that must run on Windows.
What you need
| Item | Requirement |
|---|---|
| Windows VPS | Windows Server 2019, 2022 or 2025 (or Windows 10 1809+) |
| Memory | 4 GB minimum; 8 GB recommended if you use VS Code and a browser on the server |
| Claude account | A paid plan (Pro, Max, Team or Enterprise) or a Claude Console account. The free plan does not include Claude Code. Remote Control needs a Pro, Max, Team or Enterprise plan. |
| Remote Desktop | Built into Windows (search for “Remote Desktop Connection”); on a Mac use the Windows App |
| Phone app (optional) | The Claude app for iOS or Android, to control sessions on the go |
Not sure which size to pick? A 4GB plan is enough to try Claude Code. Choose 8 GB or more if you’ll keep VS Code and a browser open on the server. See our Windows VPS plans here.
You do not need to open any firewall ports. Remote Control only makes outgoing HTTPS connections.
Option A: set everything up with one script
This is the fastest route. The script installs Git for Windows, VS Code, Claude Code and the Claude Code extension for VS Code, then creates a project folder. Anything already installed is skipped, so it is safe to run twice.
The script is plain text. Open it in Notepad first if you want to see exactly what it does.
- Connect to your VPS with Remote Desktop and download the file (or copy it over).
- Click Start, type PowerShell, right-click Windows PowerShell and choose Run as administrator.
- Paste these three lines and press Enter:
cd $env:USERPROFILE\Downloads
Unblock-File .\setup-claude-code.ps1
powershell -ExecutionPolicy Bypass -File .\setup-claude-code.ps1
The script prints each step in colour and finishes with a short “what to do next” list. It takes about 5 to 10 minutes, mostly downloading.
Optional settings
Use a different project folder:
powershell -ExecutionPolicy Bypass -File .\setup-claude-code.ps1 -ProjectPath "D:\Projects\my-app"
Also start Remote Control automatically every time you sign in to Windows:
powershell -ExecutionPolicy Bypass -File .\setup-claude-code.ps1 -AddStartupLauncher
When it finishes, skip ahead to Sign in to Claude Code at the end of Option B.
Option B: step by step with copy-paste commands
Prefer to see each step? Open PowerShell as administrator and paste the blocks below one at a time.
1. Install Git for Windows
Git lets Claude Code track changes and use Bash commands. Claude Code works without it, but works best with it.
On Windows Server 2025 (which includes winget):
winget install --id Git.Git -e --source winget
On Windows Server 2019 or 2022 (no winget by default), download and install silently:
$ProgressPreference = 'SilentlyContinue'
$rel = Invoke-RestMethod https://api.github.com/repos/git-for-windows/git/releases/latest
$url = ($rel.assets | Where-Object name -match '^Git-.*-64-bit\.exe$').browser_download_url
Invoke-WebRequest $url -OutFile "$env:TEMP\git.exe" -UseBasicParsing
Start-Process "$env:TEMP\git.exe" -ArgumentList '/VERYSILENT /NORESTART' -Wait
2. Install VS Code
With winget:
winget install --id Microsoft.VisualStudioCode -e --source winget
Without winget:
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest 'https://code.visualstudio.com/sha/download?build=stable&os=win32-x64' -OutFile "$env:TEMP\vscode.exe" -UseBasicParsing
Start-Process "$env:TEMP\vscode.exe" -ArgumentList '/VERYSILENT /NORESTART /MERGETASKS=!runcode,addtopath' -Wait
3. Install Claude Code
This is Anthropic’s official installer. It does not need administrator rights and keeps Claude Code updated automatically.
irm https://claude.ai/install.ps1 | iex
If you prefer Command Prompt instead of PowerShell:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
4. Install the Claude Code extension for VS Code
Close PowerShell and open a new window first, so it picks up the newly installed programs. Then run:
code --install-extension anthropic.claude-code
You can also install it from inside VS Code: open the Extensions panel (Ctrl+Shift+X) and search for Claude Code.
5. Create a project folder
New-Item -ItemType Directory -Force C:\Projects\my-project
Sign in to Claude Code
Check the install, then start Claude Code once to sign in:
claude --version
claude
A browser window opens. Sign in with your Claude account and return to PowerShell. Type /exit to close Claude Code. If anything looks wrong, run claude doctor for a health check.
Keep Claude Code running 24/7 with Remote Control
Remote Control links the Claude Code session on your VPS to the Claude app and claude.ai. The work still runs on your server; your browser is just the window into it.
Start a Remote Control session
Open PowerShell (a normal window is fine) and run:
cd C:\Projects\my-project
claude remote-control --name "My VPS"
The first time, Claude Code asks you to trust the folder and to confirm Remote Control. Answer y to both.
You will then see a session link. Press the spacebar to show a QR code, and scan it with your phone to open the session in the Claude app. You can also find it later in the session list on claude.ai/code, marked with a computer icon.
Already inside a Claude Code session? Type /remote-control (or /rc) to make that session available remotely.
Disconnect, don’t sign out
This is the most important habit on a Windows VPS. When you finish in Remote Desktop:
- Close the Remote Desktop window (the X at the top). Your session, PowerShell and Claude Code keep running.
- Do not choose Sign out. Signing out closes every program, including Claude Code.
Get notified on your phone
In Claude Code, type /config and turn on push notifications. Claude can then alert you when a long task finishes or needs your input.
After a reboot
Windows Update and maintenance will restart the server from time to time. To have Claude come back by itself:
- Sign in automatically. Use Microsoft’s free Autologon tool so Windows signs in to your account after a restart. (See our guide: How to set up Autologon.)
- Start Remote Control at sign-in. Run the setup script with
-AddStartupLauncher, or create the launcher yourself with this command:
$startup = [Environment]::GetFolderPath('Startup')
@'
@echo off
title Claude Code - Remote Control
cd /d "C:\Projects\my-project"
"%USERPROFILE%\.local\bin\claude.exe" remote-control --name "%COMPUTERNAME%"
pause
'@ | Set-Content "$startup\claude-remote-control.cmd" -Encoding ASCII
Run claude remote-control by hand once before relying on the launcher, so the one-time questions are already answered.
To pick up your most recent conversation instead of starting fresh:
claude remote-control --continue
Good to know: Remote Control stops if the server loses its network connection for more than about 10 minutes. Just run the command again (or reboot, if you set up the launcher).
Bonus: schedule jobs with Task Scheduler
Claude Code can also run a single task without any chat, then exit. Combine that with Windows Task Scheduler and you get jobs that run while you sleep: a nightly code review, a daily summary of a log file, a weekly dependency check.
1. Test the command by hand
cd C:\Projects\my-project
claude -p "Review the changes made today and write a short summary to review.md" --allowedTools "Read,Edit,Bash(git diff:*),Bash(git log:*)" --permission-mode acceptEdits
-p runs one task and exits. --allowedTools lists what Claude may do without asking, and acceptEdits lets it write files. Keep the list as short as the job needs.
2. Schedule it to run every night at 2:00
$action = New-ScheduledTaskAction -Execute "$env:USERPROFILE\.local\bin\claude.exe" `
-Argument '-p "Review the changes made today and write a short summary to review.md" --allowedTools "Read,Edit,Bash(git diff:*),Bash(git log:*)" --permission-mode acceptEdits' `
-WorkingDirectory 'C:\Projects\my-project'
$trigger = New-ScheduledTaskTrigger -Daily -At 2am
Register-ScheduledTask -TaskName 'Claude nightly review' -Action $action -Trigger $trigger
Run it once right away to check it works:
Start-ScheduledTask -TaskName 'Claude nightly review'
To remove it later:
Unregister-ScheduledTask -TaskName 'Claude nightly review' -Confirm:$false
The task runs as your user while you are signed in, which is exactly the state Autologon keeps the server in.
Security basics
An AI that can run commands on a server deserves a few sensible precautions.
- Use a strong Remote Desktop password, and change the default RDP port or restrict it to your IP address if your provider’s firewall allows it.
- Keep secrets out of project folders. Don’t leave passwords, API keys or customer data where Claude can read them unless the task needs them.
- Start with the default permission mode. Claude asks before running commands or editing files. Allow more only once you trust a workflow.
- Use Git. Commit before handing Claude a big task, so any change can be undone.
- Keep Windows updated, and let the reboot steps above bring Claude back afterwards.
- Sandboxing is not available on native Windows. If you need Claude’s built-in sandbox, run Claude Code inside WSL 2 on the same VPS, or use a Linux server.
Remote Control needs no open ports: the server only connects out over HTTPS, so there is nothing new for attackers to reach.
Troubleshooting
| Problem | Fix |
|---|---|
claude is not recognised |
Close PowerShell and open a new window. Still missing? Run $env:Path += ";$env:USERPROFILE\.local\bin" or reinstall with irm https://claude.ai/install.ps1 | iex. |
| “Running scripts is disabled on this system” | Use the powershell -ExecutionPolicy Bypass -File ... line exactly as shown in Option A. |
winget is not recognised |
Normal on Windows Server 2019/2022. Use the “without winget” commands or the setup script. |
| Remote Control says it is not available | Remote Control needs a Pro, Max, Team or Enterprise plan, signed in with claude.ai (not an API key). On Team or Enterprise, an admin must enable it. |
| Claude stopped after I left | You probably signed out of Remote Desktop. Next time, close the window instead. |
| Nothing came back after a reboot | Check that Autologon is set up and the launcher is in the Startup folder (type shell:startup in the Run box). |
| Anything else | Run claude doctor for a full health check. |
Wrapping up
You now have Claude Code running on a server that never sleeps. Start a task from your desk, go away and come back to finished work. For quick, Git-only jobs, Anthropic’s cloud sessions are worth a look too. For a machine that is fully yours, with a desktop, VS Code and your own tools, a Windows VPS is hard to beat.
If you don’t have a Windows VPS yet, winserver.net offers Windows Server plans from our Osaka data centre, ready to connect over Remote Desktop within minutes of signing up.
Related guides: Autologon setup · Remote Desktop basics
Frequently asked questions
Can Claude Code keep running when my own computer is turned off?
Yes. When Claude Code runs on a VPS, the work happens on the server, not on your computer. You can shut your laptop, and Claude keeps going as long as the server is on and the Claude Code window is still open.
Do I need a paid Claude plan?
Yes. Claude Code needs a paid plan (Pro, Max, Team or Enterprise) or a Claude Console account. The free plan does not include it. Remote Control specifically needs a Pro, Max, Team or Enterprise plan signed in with claude.ai.
How much memory does the VPS need?
4 GB is the minimum and is enough to try Claude Code. If you also keep VS Code and a web browser open on the server, choose 8 GB or more so everything stays responsive.
Which Windows versions are supported?
Windows Server 2019, 2022 and 2025, or Windows 10 version 1809 and later. Older versions such as Windows Server 2016 are not supported.
Is a Windows VPS or a Linux VPS better for Claude Code?
Neither is better for everyone. Windows suits you if you want a full desktop over Remote Desktop, prefer using VS Code with a mouse, or build Windows software such as .NET or IIS apps. Linux suits you if you are comfortable in a terminal and want the lightest, cheapest server. See the comparison table above for details.
Will Claude Code stop if I close Remote Desktop?
No, as long as you close the Remote Desktop window rather than signing out. Closing the window disconnects you but leaves everything running. Signing out closes all programs, including Claude Code.
What happens when the VPS restarts?
Claude Code stops when Windows restarts. To bring it back automatically, set up Autologon so Windows signs in by itself, and add the Remote Control launcher to the Startup folder (the setup script can do this with -AddStartupLauncher).
Do I need to open any firewall ports for Remote Control?
No. Remote Control only makes outgoing HTTPS connections from your server, so there is nothing to open and no new way in for attackers.
Can I use Claude Code inside VS Code on the VPS?
Yes. Install the Claude Code extension for VS Code (the setup script does this for you) and use Claude in a panel next to your code, just as you would on your own PC.
Is the setup script safe to run?
The script is plain text, and you can read every line on this page before downloading. It only installs Git for Windows, VS Code, Claude Code and the Claude Code extension from their official sources, and creates a project folder. As with any script, we recommend reviewing it and trying it on a test server first.
Can I set it up without the script?
Yes. Option B walks through the same steps one command at a time, so you can see and run each part yourself.
Does running Claude Code 24/7 cost extra?
Claude Code uses the usage included in your Claude plan, so a long-running session counts toward your plan’s limits like any other session. If you use a Claude Console account, usage is billed by how much you use. The VPS itself is billed separately by your hosting provider.
Looking for a Japan-Based VPS?
If you regularly access Japanese online services from overseas, a Japan-based VPS gives you a dedicated remote Windows environment hosted in Japan. Compare available plans, resources, and connection options to find a setup that fits your needs.

