如何从Raspberry Pi 3远程关闭Windows 10电脑(优先无线方式)
Wireless Remote Shutdown: Raspberry Pi 3 → Windows 10
Hey there! Since you already tried that Linux-to-Windows shutdown guide and it didn't pan out, let's walk through three reliable, wireless methods that should get your Pi shutting down your Win10 PC without a hitch. All these work over your local Wi-Fi network—no cables needed.
Method 1: Use WMI (Windows Native Tooling)
WMI is Windows' built-in management interface, perfect for remote actions like shutdown. Here's how to set it up:
On Windows 10:
- First, enable the WMI service: Press
Win+R, typeservices.msc, find Windows Management Instrumentation, ensure it's running, and set its startup type to Automatic. - Configure the firewall: Go to Control Panel → Windows Defender Firewall → Advanced Settings → Inbound Rules. Find the Windows Management Instrumentation (WMI-In) rule, enable it for your private Wi-Fi network.
- Quick shortcut: Open an admin Command Prompt and run
winrm quickconfig—this auto-configures WinRM (which powers WMI) and firewall rules in one go. Just follow the on-screen prompts.
On Raspberry Pi 3:
- Install the
winexetool (a Linux utility to run Windows commands over SMB/WMI):sudo apt update && sudo apt install winexe -y - Run the shutdown command (replace placeholders with your Win10 details):
winexe -U YOUR_WIN_PC_NAME/YOUR_ADMIN_USER%YOUR_PASSWORD //YOUR_WIN10_IP "shutdown /s /t 0"YOUR_WIN_PC_NAME: Name of your Windows 10 PC (check viaWin+Pause/Break).YOUR_ADMIN_USER: A Windows admin account username.YOUR_PASSWORD: The account's password.YOUR_WIN10_IP: Your PC's local Wi-Fi IP (find viaipconfigin Command Prompt).
Method 2: SSH into Windows 10 (Simpler for Linux Users)
If you're comfortable with SSH, this is a straightforward option—Win10 has native OpenSSH support now.
On Windows 10:
- Install OpenSSH Server: Go to Settings → Apps → Optional Features → Add a feature, search for OpenSSH Server, and install it.
- Start the SSH service: Press
Win+R, typeservices.msc, find OpenSSH SSH Server, start it, and set startup type to Automatic. - The firewall should auto-add an SSH inbound rule, but double-check in Advanced Firewall Settings if you run into issues.
On Raspberry Pi 3:
- Run the shutdown command directly via SSH:
ssh YOUR_ADMIN_USER@YOUR_WIN10_IP "shutdown /s /t 0" - To avoid entering your password every time, set up SSH key authentication:
- Generate a key pair on your Pi:
ssh-keygen(just press Enter through all prompts). - Copy the public key to your Windows PC:
scp ~/.ssh/id_rsa.pub YOUR_ADMIN_USER@YOUR_WIN10_IP:C:\Users\YOUR_ADMIN_USER\.ssh\authorized_keys - On Windows, right-click the
authorized_keysfile → Properties → Security → Advanced. Set the owner to your admin user, and ensure only that user has read access (remove all other permissions).
- Generate a key pair on your Pi:
Method 3: PowerShell Remote Execution
PowerShell gives you more flexibility if you want to run additional commands alongside shutdown.
On Windows 10:
- Enable PowerShell remoting: Open an admin PowerShell window and run:
Enable-PSRemoting -Force - Trust your Pi's IP (replace
YOUR_PI_IPwith your Raspberry Pi's local Wi-Fi IP):Set-Item WSMan:\localhost\Client\TrustedHosts -Value "YOUR_PI_IP" -Concatenate
On Raspberry Pi 3:
- Install PowerShell Core:
sudo apt update && sudo apt install powershell -y - Run the shutdown command:
Enter your Windows admin username and password when prompted. You can also set up key-based authentication here for passwordless access.pwsh -Command "Invoke-Command -ComputerName YOUR_WIN10_IP -Credential (Get-Credential) -ScriptBlock { shutdown /s /t 0 }"
Quick Troubleshooting Tips
- Firewall Issues: If commands fail, double-check that your Windows firewall allows inbound connections for the service you're using (WMI, SSH, or WinRM) on your private network.
- Static IPs: Assign static local IPs to both your Pi and Win10 PC so you don't have to look up IPs every time.
- Test First: Replace
shutdown /s /t 0withshutdown /r /t 0(restart) to test if the command works before using shutdown.
内容的提问来源于stack exchange,提问作者Ben Davies
相关产品推荐
相关产品推荐

