---
title: "在 Windows 上安装 | Wantastic Docs"
description: "在 Windows 10/11 和 Windows Server 上安装 wantasticd：以管理员身份打开 PowerShell，粘贴一行命令，然后在浏览器中批准设备。"
url: "https://wantastic.app/zh/docs/install-windows"
category: "Install wantasticd"
reading_time: "3 分钟"
---

# 在 Windows 上安装

在 Windows 10/11 和 Windows Server 上安装 wantasticd：以管理员身份打开 PowerShell，粘贴一行命令，然后在浏览器中批准设备。

> **Outcome:** wantasticd 作为自动启动的 Windows 服务 "Wantastic Overlay Networking" 运行，托盘应用在登录时启动，电脑在控制台中显示为 Online。

## Before you start

- Windows 10、Windows 11 或 Windows Server 2016+（x64、ARM64 或 32 位）。
- 一个可以批准管理员提示的 Windows 账户。
- 你的 Wantastic 账户（安装过程中只需登录一次）。

## 快速安装（4 步）

1. 以管理员身份打开 PowerShell。
2. 粘贴 irm https://get.wantastic.app/install.ps1 | iex 并按 Enter。
3. 扫描二维码，或按住 Ctrl 点击链接。
4. 在浏览器中点击 Claim Device。电脑会自动连接。

PowerShell（管理员）:

```powershell
irm https://get.wantastic.app/install.ps1 | iex
```

> **Tip:** 更喜欢安装向导？在 wantastic.app/download 下载并运行，然后点击时钟旁的 Wantastic 图标，选择 Log in…。

> **Operational note:** 下面的图片展示了每一步。

## 以管理员身份打开 PowerShell

安装程序会创建 Windows 服务，因此 PowerShell 必须以管理员身份运行。

1. 点击开始（或按 Windows 键），输入 powershell。
2. 在右侧点击 Run as administrator（以管理员身份运行）。
3. Windows 会询问 "Do you want to allow this app to make changes to your device?"（你要允许此应用对你的设备进行更改吗？）。点击 Yes（是）。
4. 会打开一个蓝色窗口，标题以 Administrator: Windows PowerShell（管理员: Windows PowerShell）开头。

*Console: 开始 → 输入 powershell → Run as administrator。*

1. 输入 powershell
2. 点击 Run as administrator（以管理员身份运行）

*Console: 管理员提示。确认显示的是 Windows PowerShell，然后点击 Yes（是）。*

1. Windows PowerShell
2. 点击 Yes（是）

> **Tip:** 更快的方法：右键点击开始按钮，选择 Terminal (Admin) 或 Windows PowerShell (Admin)。

## 粘贴、扫描、批准

1. 将这一行粘贴到管理员窗口中并按 Enter。
2. 会出现一个二维码和一个链接。用手机扫描二维码，或按住 Ctrl 点击链接。
3. 登录 Wantastic 并点击 Claim Device。
4. 电脑会自动连接，托盘图标变为绿色，并在 Devices 中显示为 Online。

*Administrator: Windows PowerShell: 安装程序会显示二维码和认领链接，无需令牌。*

```
$ PS C:\Windows\system32> irm https://get.wantastic.app/install.ps1 | iex
Wantastic Agent - Windows Installer
Version: v1.0.54+377f3c0
Installed to C:\Program Files\Wantastic\wantasticd.exe
█▀▀▀▀▀█ ▄▀▄ █▀▀▀▀▀█   (QR code)
wantasticd v1.0.54+377f3c0 is installed and waiting to be added to your account.
Scan the QR code above, or open this link, and approve the device:
  https://console.wantastic.app/#desktop?claim_public_key=Vd3hK1oQ…%3D
It connects by itself as soon as it is claimed (the tray icon turns green).
```

*Console: Claim Wantastic Device。Claim URL 和二维码会自动填入密钥，你只需点击 Claim Device。*

1. Claim public key 已自动填写
2. Wantastic server 保持默认即可
3. 点击 Claim Device

> **Operational note:** 30 秒后仍没有二维码或链接？按 Ctrl+C，然后使用“其他安装方式”中的“使用令牌安装”。

## 检查是否正常工作

1. 打开一个新的 PowerShell 窗口，运行 wantasticd status。它会显示 Status: Connected。
2. 托盘图标（时钟旁边）显示连接状态。
3. 在控制台中打开 Devices。电脑显示为 Online。

PowerShell（新窗口）:

```powershell
wantasticd status
```

*wantasticd status: Status: Connected 加上 VPN IP 表示隧道已建立。*

```
$ PS C:\> wantasticd status
Status:        Connected
Version:       v1.0.54+377f3c0
Mode:          TUN (wantastic0)
VPN IPs:       10.200.0.14/32
Public key:    q7ZkV3m1yH0dTn8pXo2bLwR4sE6uJ9cA1fG5hK8iN0M=
Server:        wg.wantastic.app:51820
Exit node:     false
Local access:  false
Auto update:   true
Traffic:       ↓ 18.4 KiB  ↑ 9.2 KiB
Peers:         2 (direct 1, relay 1)
Uptime:        4m12s
```

*Console: Devices 窗口：新设备以其名称出现，并在几秒钟内变为 Online。*

1. 按名称搜索
2. 状态显示 Online
3. 覆盖网络 IP 与 wantasticd status 一致
4. Last seen 持续更新

## 管理服务

- 你也可以使用 services.msc → Wantastic Overlay Networking。
- 如果 Windows 防火墙询问是否允许 wantasticd.exe 通信，请点击 Allow。设备之间的直连需要此权限。
- 如果杀毒软件阻止了隧道适配器，请为 C:\Program Files\Wantastic\wantasticd.exe 添加排除项。
- 要升级，请使用 wantasticd update。不要在正常工作的电脑上再次运行 install.ps1。

PowerShell（管理员）:

```powershell
Restart-Service wantasticd
Stop-Service wantasticd
Start-Service wantasticd
Get-Service wantasticd
```

## 其他安装方式

仅在特殊情况下才需要这些方式。

### 安装向导 (.exe)

在 wantastic.app/download 下载 wantastic-setup-windows-amd64.exe（或 -arm64.exe）。

1. 打开安装文件，点击“是”，然后点击“安装”。
2. 点击时钟旁的 Wantastic 图标，选择 Log in…。
3. 浏览器会打开。点击 Claim Device。

> 批量部署静默安装：wantastic-setup-windows-amd64.exe /VERYSILENT /SUPPRESSMSGBOXES

### 使用令牌安装

适用于大量电脑，或没有出现二维码时。在控制台打开 Account → Secrets，点击 + New Secret，再点击 Generate 并复制。替换下面的 <TOKEN>。

PowerShell（管理员）:

```powershell
& ([scriptblock]::Create((irm https://get.wantastic.app/install.ps1))) -Token <TOKEN>
```

> 像对待密码一样对待令牌。在其过期之前，任何持有它的人都能向你的账户添加设备。

### 不使用托盘应用

适用于服务器和共享电脑。服务仍会运行。

PowerShell（管理员）:

```powershell
& ([scriptblock]::Create((irm https://get.wantastic.app/install.ps1))) -NoTray
```

### 自托管门户

install.ps1 没有门户选项。请先安装，然后登录到你的门户并重启。

PowerShell（管理员）:

```powershell
& "C:\Program Files\Wantastic\wantasticd.exe" login --no-connect --portal-url https://wantastic.example.com --token <TOKEN>
Restart-Service wantasticd
```

## Verify the result

- Get-Service wantasticd 显示 Running。
- wantasticd status 显示 Status: Connected。
- 电脑在 Devices 中显示为 Online，重启后依然如此。

## Common issues

### 安装程序立即停止。

```
Administrator privileges are required.
```

- **Where:** install.ps1
- **Likely cause:** PowerShell 未以管理员身份打开。
- **Fix:** 关闭窗口。点击开始，输入 powershell，点击 Run as administrator，再点击 Yes，然后重新粘贴这一行。

PowerShell（管理员）:

```powershell
irm https://get.wantastic.app/install.ps1 | iex
```

### 没有出现二维码或链接；安装程序一直在等待。

- **Where:** install.ps1 · === Logging in ===
- **Likely cause:** Windows 上较旧的 wantasticd 版本无法显示登录二维码和链接。
- **Fix:** 按 Ctrl+C。在 Account → Secrets 中创建令牌并用它安装。

PowerShell（管理员）:

```powershell
& ([scriptblock]::Create((irm https://get.wantastic.app/install.ps1))) -Token <TOKEN>
```

### 登录未完成，服务未启动。

```
Login did not complete (exit 1).
The service is installed but not started because this device is not logged in yet.
```

- **Where:** install.ps1
- **Likely cause:** 浏览器中的批准未及时完成、被拒绝，或令牌错误。
- **Fix:** 重新登录并批准设备，然后启动服务。

PowerShell（管理员）:

```powershell
wantasticd login --no-connect
Start-Service wantasticd
```

- **Verify:** wantasticd status 显示 Connected。

### 无法从保存的文件运行脚本。

```
install.ps1 cannot be loaded because running scripts is disabled on this system.
```

- **Where:** PowerShell
- **Likely cause:** PowerShell 策略阻止了已保存的脚本文件。
- **Fix:** 请改用单行安装命令，该策略不会阻止它。

PowerShell（管理员）:

```powershell
irm https://get.wantastic.app/install.ps1 | iex
```

### 安装程序重新创建服务时 sc.exe 失败。

```
Failed to create the Windows service (sc.exe exit code 1072).
```

- **Where:** install.ps1
- **Likely cause:** services.msc 或事件查看器仍打开着旧服务。
- **Fix:** 关闭 services.msc 和事件查看器（或重启电脑），然后再次粘贴安装代码块。

### PowerShell 无法识别 wantasticd。

```
wantasticd : The term 'wantasticd' is not recognized as the name of a cmdlet, function, script file, or operable program.
```

- **Where:** PowerShell
- **Likely cause:** PATH 的更改只对新窗口生效。
- **Fix:** 打开一个新的 PowerShell 窗口。

### 无法创建隧道适配器。

```
Error creating interface: …
```

- **Where:** 调试日志
- **Likely cause:** 杀毒软件或 EDR 软件阻止了隧道驱动。
- **Fix:** 为 C:\Program Files\Wantastic\wantasticd.exe 添加杀毒软件排除项，然后重启服务。

重启:

```powershell
Restart-Service wantasticd
```

### 令牌安装在下载后立即失败。

```
Login failed: registration rejected (401): invalid or expired login token
```

- **Where:** install.ps1 / wantasticd login
- **Likely cause:** 令牌错误、已过期、已用完（达到 Max Uses）或已被删除。
- **Fix:** 在 Account → Secrets 中创建新密钥，并用它登录。

修复:

```powershell
& "C:\Program Files\Wantastic\wantasticd.exe" login --no-connect --token <NEW_TOKEN>
Restart-Service wantasticd
```

### 认领或登录被拒绝。

```
Login failed: account has reached its device limit — upgrade your plan or remove an existing device
```

- **Where:** wantasticd login / 控制台
- **Likely cause:** 你的套餐设备数量已满。控制台显示 "You have reached the maximum number of devices for your plan."
- **Fix:** 在 Devices 中删除一台不再使用的设备（设备行 → Delete），或升级套餐。然后重新认领。

### wantasticd status 打印 Offline。

```
Status: Offline — daemon not running (start: sc.exe start wantasticd)
```

- **Where:** wantasticd status
- **Likely cause:** 后台服务已停止、已崩溃或仍在启动中。status 命令不会启动服务。
- **Fix:** 启动服务。

启动服务:

```powershell
Start-Service wantasticd
```

### status 显示 Running (tunnel down)，或 peers 显示 (server) 为 HANDSHAKE never。

```
Device health check failed: …
```

- **Where:** 服务日志
- **Likely cause:** 网络阻止了到中心节点（wg.wantastic.app）的出站 UDP 51820 端口，或 DNS 不可用。
- **Fix:** 在防火墙中放行出站 UDP 51820，然后重启服务。

测试 DNS 并重启:

```powershell
nslookup wg.wantastic.app
Restart-Service wantasticd
```

- **Verify:** wantasticd peers 显示 (server) 有最近的握手（例如 "8s ago"）。

### 本地访问在 Windows 上无法使用。

```
automatic local-access subnet routing is not supported on Windows yet
```

- **Where:** 调试日志
- **Likely cause:** 本地访问仅适用于 Linux 和 OpenWrt。
- **Fix:** 在该局域网中的一台 Linux 设备上安装 wantasticd，并在那台设备上开启本地访问。

## Continue with

- [Choose your install method](https://wantastic.app/zh/docs/install-overview): Find your device in one table and copy one command. Most devices install in 2 minutes: install, scan a QR code, click Claim Device.
- [wantasticd CLI reference and operations](https://wantastic.app/zh/docs/wantasticd): The most used wantasticd commands first, then every command and flag, environment variables, config and state paths per OS, log lines, local access, exit node, and the claim flow (genkey / --wait-claim).
- [Update, roll back and uninstall](https://wantastic.app/zh/docs/update-and-uninstall): Update or uninstall wantasticd with one line per OS. Also: how auto-update works, turning it off, rolling back to the previous binary, and purging all data.
- [macOS and Windows errors](https://wantastic.app/zh/docs/errors-macos-windows): launchd, Gatekeeper, tray, sc.exe and Windows service errors with the easiest fixes.
- [Login, token and claim errors](https://wantastic.app/zh/docs/errors-login-claim): Fix claim problems (genkey, QR code, Claim Device), "Login failed: …" messages and token errors.
- [WebProxy for device web UIs](https://wantastic.app/zh/docs/webproxy): Open a router, NAS or camera web page in the console. No port forward needed.
