批次將hosts檔案傳送到學生端的cmd指令方式(含批次關機、重新開機)

在教師機端用本機管理員的身分(administratgor)登入後,確保每個學生端的電腦都有本機管理員(administratgor)帳號,密碼都要設一樣,因為本校無AD所以要這樣設。

 

批次將hosts檔案複製並傳送到學生端主機指令

xcopy /Y hosts \st01c$windowssystem32driversetc

//st01代表的是學生端的主機名稱//

 

所以可以在記事本寫下如下檔案

xcopy /Y hosts \st01c$windowssystem32driversetc

xcopy /Y hosts \st02c$windowssystem32driversetc

xcopy /Y hosts \st03c$windowssystem32driversetc

xcopy /Y hosts \st04c$windowssystem32driversetc

xcopy /Y hosts \st05c$windowssystem32driversetc

xcopy /Y hosts \st06c$windowssystem32driversetc

xcopy /Y hosts \st07c$windowssystem32driversetc

xcopy /Y hosts \st08c$windowssystem32driversetc

xcopy /Y hosts \st09c$windowssystem32driversetc

xcopy /Y hosts \st10c$windowssystem32driversetc

xcopy /Y hosts \st11c$windowssystem32driversetc

xcopy /Y hosts \st12c$windowssystem32driversetc

 

最後再儲存成.bat檔,只要每一次改變教師機的電腦hosts檔後,就可以批次傳送。

————————————————————————————————-

批次遠端關機方式指令

shutdown -m \st01 -s -t 00

shutdown -m \st02 -s -t 00

shutdown -m \st03 -s -t 00

shutdown -m \st04 -s -t 00

shutdown -m \st05 -s -t 00

shutdown -m \st06 -s -t 00

shutdown -m \st07 -s -t 00

shutdown -m \st08 -s -t 00

shutdown -m \st09 -s -t 00

shutdown -m \st10 -s -t 00

shutdown -m \st11 -s -t 00

shutdown -m \st12 -s -t 00

——————————————————————————

批次遠端重新開機

shutdown -m \st01 -r -t 00

shutdown -m \st02 -r -t 00

shutdown -m \st03 -r -t 00

shutdown -m \st04 -r -t 00

shutdown -m \st05 -r -t 00

shutdown -m \st06 -r -t 00

shutdown -m \st07 -r -t 00

shutdown -m \st08 -r -t 00

shutdown -m \st09 -r -t 00

shutdown -m \st10 -r -t 00

shutdown -m \st11 -r -t 00

shutdown -m \st12 -r -t 00