Complete Guide to Remotely Controlling Windows PCs via a NAS AI Agent
This article provides a comprehensive guide on deploying a local AI agent on a Network Attached Storage (NAS) device to remotely control a Windows PC via SSH. By combining the 24/7 availability of a NAS with the computing power of a Windows machine, users can establish a secure, local automation pipeline for scheduled tasks, multi-device orchestration, and web automation. The guide covers configuring the OpenSSH server on Windows, setting up the NAS agent, and troubleshooting common issues.
1. Background and Use Cases
Deploying an AI agent on a NAS to remotely control a home or office Windows PC is an ideal architecture that balances uptime and computing power. NAS devices feature low power consumption and 24/7 availability, making them perfect as a persistent control hub. Windows PCs offer stronger performance and a richer software ecosystem, suitable for heavy computations and GUI operations. Together, they create a complete local automation pipeline.
This solution is suitable for the following scenarios:
- Scheduled Task Execution: Leveraging the NAS’s always-on nature to wake up or control a Windows PC at specified times for batch processing or data handling.
- Secure Intranet Interaction: The entire pipeline runs within the local area network (LAN) without relying on public network exposure, ensuring higher security.
- Multi-Device Automation: Integrating sensors, home servers, and personal computers into a unified automated workflow.
- Web Automation: Remotely driving a browser via command line to perform web form submissions, data scraping, and other operations.
2. Windows Configuration: Enabling and Hardening SSH
Modern Windows systems have a built-in OpenSSH Server component, eliminating the need for third-party remote tools while ensuring security and compatibility.
Enable OpenSSH Server. Add the OpenSSH Server via “Settings > Apps > Optional Features,” or run the following commands in an administrator terminal:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0Start-Service sshdSet-Service -Name sshd -StartupType Automatic
Fix Password Login Restrictions for Administrator Accounts. By default, the built-in Administrator account may exhibit abnormal behavior when logging in via SSH, often rejecting correct passwords. Check and adjust the login policy for the administrator group in the SSH configuration to ensure “Password Authentication” is enabled.
Create a Dedicated Remote Account (Highly Recommended). It is not recommended to use the Administrator account for remote connections for three reasons: policy limitations on the built-in admin, high risk from excessive privileges, and difficulty in auditing actions by account. The correct approach is to create a standard user, add it to necessary user groups as needed, and set a strong password.
net user remote_user YourStrongPassword /addnet localgroup Administrators remote_user /add (Execute only if privilege escalation is required)
3. NAS Configuration: Enabling Remote Execution for the AI Agent
A local AI agent deployed on the NAS can gain the ability to issue commands to the Windows PC through a “remote connection template.” This template is essentially a set of predefined connection parameters and command invocation methods. Configuration points include:
- Connection Parameters: Enter the Windows PC’s LAN IP address, SSH port (default 22), dedicated username, and password.
- Static IP or Hostname Mapping: It is recommended to bind the IP and MAC address of the Windows PC in the router to prevent connection failures caused by DHCP address changes.
- Command Template Examples:
- Check PC Status:
systeminfoorhostname && whoamito confirm the target host is online and the identity is correct. - File Transfer: Use the built-in SCP channel of SSH to upload and download files between the NAS and the PC.
- Browser Automation: Remotely launch the browser in headless or headed mode, combined with automation scripts for web operations. For example:
"C:\Program Files\...\browser.exe" --headless --disable-gpu --dump-dom https://example.com
- Check PC Status:
Once configured, you can issue conversational commands to the agent, such as “Check if the PC is online” or “Push the backup file from the NAS to the PC’s D drive.” The agent will translate these into specific SSH commands and execute them.
4. Troubleshooting Guide
- Permission Denied: First verify if the account password is correct and if the account is disabled. Check if the Windows SSH configuration allows the account to log in, and confirm that the administrator group login policy has been fixed.
- Connection Timeout: Troubleshoot the network layer by layer—ensure the Windows firewall allows port 22 (create a new inbound rule if necessary), verify both devices are on the same subnet, and check if the IP address has changed.
- Account Rejected: Confirm that the restricted built-in Administrator account is not being used. Ensure the new account has a password set and is not marked as “Account is disabled.”
- Gibberish Output: The Windows terminal uses GBK encoding by default, while SSH clients usually parse in UTF-8. Run
chcp 65001before the session to switch encodings, or have the agent handle the encoding conversion before parsing the output. - Command Not Found: The environment variables in a remote session differ from a login session. It is recommended to use absolute paths to invoke commands.
5. Verification Checklist
After deployment, verify the following in order:
- You can ping the Windows PC’s LAN IP from the NAS;
- The SSH connection is successful, logging in with the dedicated account rather than the built-in administrator;
- Remote execution of
whoamireturns the expected username; - System information commands return normally without garbled text;
- Files can be transferred bidirectionally, with matching size and checksum values;
- Browser automation commands execute successfully and return expected results;
- The agent can correctly select and execute the above operations based on natural language instructions.
6. Conclusion
The combination of a resident AI agent on the NAS and a Windows controlled endpoint uses the system’s native SSH capabilities as the communication foundation. This avoids the licensing and security burdens of third-party remote tools while fully utilizing the respective advantages of both device types. By following the steps for server configuration, dedicated account creation, and troubleshooting, you can build a stable, secure, and scalable local automation pipeline at a low cost, laying a solid foundation for more complex multi-device collaborative automation in the future.
