使用樹莓派控制局域網(wǎng)內(nèi)的電腦開關機
[TOC]
開機
配置電腦端
- 設置BIOS允許從網(wǎng)卡啟動
- 打開網(wǎng)絡和共享中心--以太網(wǎng)--屬性--配置--電源管理--允許此設備喚醒計算機
配置樹莓派
# 安裝wakeonlan
sudo apt install wakeonlan
# 查詢電腦的IP地址和網(wǎng)卡的mac地址
arp -a
? (192.168.8.180) at cc:08:fb:f7:44:a3 [ether] on eth0
tom-ubuntu.lan (192.168.8.112) at 00:e0:4c:68:06:28 [ether] on eth0
tom-desktop.lan (192.168.8.199) at 04:92:26:cf:87:f7 [ether] on eth0
C-329.lan (192.168.8.1) at a8:80:38:22:ee:0f [ether] on eth0
# 使用wakeonlan喚醒計算機
wakeonlan -i 192.168.8.199 04:92:26:cf:87:f7
Sending magic packet to 192.168.8.199:9 with 04:92:26:cf:87:f7
關機
配置電腦端
- 打開服務--找到Remote Registry服務并設置為自動啟動--登錄選項卡勾選本地系統(tǒng)賬戶
- 打開防火墻--允許應用通過防火墻--勾選遠程服務管理
- 修改注冊表
- 導航到HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System
- 創(chuàng)建名為LocalAccountTokenFilterPolicy的DWORD
- 設置LocalAccountTokenFilterPolicy的值為1
配置樹莓派端
# 安裝samba
sudo apt install samba
# 使用命令關機
net rpc shutdown -I 192.168.8.199 -U username%password