PHP implementation close remote computer _php tutorial

Source: Internet
Author: User
There are many ways to implement a remote computer, and here's how to extract a shutdown command description if you shut down a remote Windows computer

The shutdown command syntax format is: shutdown [-i |-l|-s |-r |-a] [-f] [-M [\ComputerName]] [-t-XX] [-C "message"] [-d[p]:xx:yy].

"-I" displays a dialog box for the graphical interface.

"-L" unregisters the current user, which is the default setting.

"-S" shuts down the computer.

"-R" is turned off and then restarted.

"-A" abort shutdown.

"-F" forces the application to be shut down.

"-M [\computername] Specifies the computer to be shut down.

"-T-XX" Sets the timer for system shutdown to xx seconds, and the default value is 20 seconds.

"-C" message "Specifies the message that will be displayed in the messages area of the system Shutdown window, with a maximum of 127 characters, and must contain a message in quotation marks.

"-d [p]:xx:yy] lists the reason codes for system shutdown.

In addition to "-L" and "ComputerName", the system ignores other parameters. Only "-a" can be used during the time-out period.

For example, turning off the remote computer input "shutdown-s-m \work1-t 60" means that after 60 seconds the machine named work is turned off, and the machine must also have a Windows XP operating system. The input "shutdown-s-T 30" means that the machine shuts down automatically after 30 seconds. "Shutdown-l" means to unregister the native user, which does not apply to the remote computer. Use "Shutdown-r" to restart the local computer. "Shutdown-a" can cancel an already issued shutdown command. You can use "Shutdown-s" when you want to shut down the local computer.

In PHP, System and exec can perform shutdown commands, and if the remote computer's hardware and software configuration meets the following criteria: Grant the Guest user permission to remotely shut down the machine. When a remote user connects to a local Windows XP system that is connected as guest, the remote shutdown requires administrator privileges, so the guest user is given permission to remotely shut down the computer. Start the computer that requires a remote shutdown, enter gpedit.msc in the Run dialog box, and open the Group Policy Editor. Expand Computer Configuration → Windows settings → security settings → local policies → user rights Assignment, locate the force shutdown from remote system option in the right window. Double-click the item, in the Pop-up dialog box, by clicking the Add button, and then entering the user name "Guest" in the new dialog box, and then clicking OK. Now that the "guest" user is in the "Force shutdown from remote system" attribute, click the "OK" button to exit.


Code:

System (Shutdown-s-M \work1-t 60);
?>

http://www.bkjia.com/PHPjc/486240.html www.bkjia.com true http://www.bkjia.com/PHPjc/486240.html techarticle There are many ways to implement a remote computer, if you close a remote Windows computer, the first excerpt of a shutdown command description shutdown command syntax format is: shutdown [-I |-l|-...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.