本文目錄一覽:
如何實現遠程計算機/服務器的開機和關機
遠程開機:
使用遠程喚醒技術(WOL,Wake-on-LAN),計算機只要處於同一局域網內,就能夠被隨時啟動。它通過局域網內計算機網卡的MAC地址,用軟件發送包含該地址的特殊數據包以喚醒計算機。
被控制計算機的硬件需求:
實現網絡開機,需要主板、網卡、電源3個設備支持。首先需要查看主板和網卡使用說明書,查看主板和網卡是否支持Wake-up On LAN(WOL)技術,如果支持就說明能夠實現遠程開機。另外,電腦必須安裝有符合ATX 2.03標準的ATX電源,+5VStandby電流至少應在720mA以上。
其實就目前新配置的計算機而言,一般都支持網絡開機。
CMOS設置 :首先在啟動時按DEL進入CMOS參數設置。選擇電源管理設置“Power Management Setup”菜單,將“ModemRing/WakeOnLAN”項和“PME Event Wakeup”項均設置為“Enable”,啟用該計算機的遠程喚醒功能(主板自帶網卡的,主板不同,這些選項也不完全相同)。
在控制端裝上遠程開機的軟件NetWaker,運行後在界面MAC地址欄中中輸入被控計算機MAC地址,點擊“發送開機信號”就能喚醒該地址的計算機了。
遠程關機:
在桌面連接窗口中我們是不能用“開始→關閉計算機”的步驟來關機的。我們這裡採用了系統自帶的shutdown命令來控制。可以兩種方法實現:①在控制窗口中的計算機桌面中點擊“開始→運行”輸入“shutdown –s –t 30”命令來實現關機。②在本機上運行“shutdown –s –m\\被控計算機名 -t 30”,這種方法還要在對方的計算機中組策略中設置,賦予guest用戶遠程關機的權限。
利用java編程,控制計算機關機
哈哈,這個我正好可以幫你,以前寫了類似程序
開機運行:String regKey = “HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run”;
String myAppName = “DaKa”;
try {
Runtime.getRuntime().exec(“reg ” + (isStart ? “add ” : “delete “) + regKey + ” “
+ myAppName + (isStart ? ” /t reg_sz /d ” + dirpath : ” /f”));
dirpath是你當前文件的絕對路徑(包括文件名)
關機:Runtime.getRuntime().exec(“shutdown -s -f -t 10”);
java怎麼實現遠程關閉計算機,遠程喚醒的做好了,遠程關機的不知道該怎麼做
有管理員權限吧,那用shutdown命令就可以了
shutdown -m \\192.168.0.10 -f -s -t 0
shutdown /? 看看幫助信息。
C:\Windows\system32shutdown /?
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c “comment”]]
No args Display help. This is the same as typing /?.
/? Display help. This is the same as not typing any options.
/i Display the graphical user interface (GUI).
This must be the first option.
/l Log off. This cannot be used with /m or /d options.
/s Shutdown the computer.
/r Shutdown and restart the computer.
/g Shutdown and restart the computer. After the system is
rebooted, restart any registered applications.
/a Abort a system shutdown.
This can only be used during the time-out period.
/p Turn off the local computer with no time-out or warning.
Can be used with /d and /f options.
/h Hibernate the local computer.
Can be used with the /f option.
/e Document the reason for an unexpected shutdown of a computer.
/m \\computer Specify the target computer.
/t xxx Set the time-out period before shutdown to xxx seconds.
The valid range is 0-315360000 (10 years), with a default of 30.
If the timeout period is greater than 0, the /f parameter is
implied.
/c “comment” Comment on the reason for the restart or shutdown.
Maximum of 512 characters allowed.
/f Force running applications to close without forewarning users.
The /f parameter is implied when a value greater than 0 is
specified for the /t parameter.
/d [p|u:]xx:yy Provide the reason for the restart or shutdown.
p indicates that the restart or shutdown is planned.
u indicates that the reason is user defined.
If neither p nor u is specified the restart or shutdown is
unplanned.
xx is the major reason number (positive integer less than 256).
yy is the minor reason number (positive integer less than 65536).
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/248711.html