Windows 主机接入
Windows 主机接入
AI SSH 运维 Agent 支持 SSH + PowerShell 管理 Windows 主机(Windows 10/11、Windows Server 2016+),和 Linux 主机一样用自然语言操作。
前置条件
- Windows 主机开启 OpenSSH Server(设置 → 应用 → 可选功能 → 添加 OpenSSH 服务器;Server 版可用
Add-WindowsCapability安装) - 确认 sshd 服务运行中:
Get-Service sshd - 防火墙放行 22 端口
添加主机
Web 图形界面「添加主机」时设备类型选择 Windows,填 IP / 用户名 / 密码即可。
终端版在 config/hosts.yml 中为该主机增加 device_type: windows。
能做什么
- 自然语言执行 PowerShell 任务:查服务、看进程、改配置、管理 IIS / SQL Server / MySQL 等 Windows 服务
- 中文 GBK 输出双重解码,不会出现乱码
- 多行 PowerShell 脚本(
run_script)通过 stdin 通道注入执行,不受命令行长度限制 - Windows 方言高危命令识别(24 条规则):
Stop-Computer、Remove-Item -Recurse等照常走人工确认 - 值守监测支持 Windows 角色:自动识别 IIS / SQL Server / MySQL 服务探针,服务异常即告警
注意事项
- 建议使用 Administrator 或具备远程管理权限的账户
- 域环境主机首次连接若失败,检查 sshd 的默认 shell 配置