A program for remote computer restart. How to turn on a computer from a distance using the WOL program. Shutdown or restart the computer using the Shutdown command

I got the task of organizing a quick shutdown of remote servers in one click. Moreover, a variety of users should turn off the server, including those without knowledge and understanding of the principles of the server. That is, they just have to press a button for the server to automatically shut down.

Moreover, you need to turn off both windows servers and linux of various distributions - ubuntu, centos, freebsd over the network. That is, the solution should be simple and reliable.

Remote shutdown of Windows server

Let's start with the hardest part. In practice, implement reliable way shutdown windows machines over the network turned out to be more difficult for me than linux. There are many methods and approaches to solving this problem. I tried different options and settled on one that seemed to me the most reliable, it worked without problems in all cases during testing.

A prerequisite for remote shutdown of the server is network access to it via rdp. You can be in local network with it, or forward the rdp connection with a redirect from the gateway. It doesn't matter, the main thing is to get into the system via rdp.

The principle of operation of remote shutdown is as follows:

  1. A user is created on the computer or server, who will be allowed to connect via rdp and shut down the server.
  2. At startup of this user, there will be a script to complete the work.
  3. Users who will shutdown the server remotely are given a specially prepared rdp client, which without any requests will be connected by the right user, who will run a script to shutdown.

Everything is quite simple, but at each stage I encountered problems that required a non-trivial solution. But first things first.

So let's go north and create a simple bat file with the following content:

Shutdown / p / d p: 0: 0 / f

We save the file and create a user under which we will turn off the server. Don't forget to add rdp permission for this user. If you turn off a computer with a desktop system, then the rights of a regular user are sufficient. If you need to repay Windows Server, then the user must either be made an administrator, or give him permission to shutdown the server through the local security policy. This policy lives at - security settings - local policies - assigning user rights - shutting down the system.

Here I ran into the first troubles. I named my script shutdown.bat and for a very long time could not understand why it did not work. When entering the command shutdown everything worked fine with the parameters in the console, but the script did not start. It turns out that he cannot be called by that name. After renaming to shut.bat everything worked fine. Some kind of ridiculous snag, but I had to spend a lot of time until I figured out what was the matter.

Next, we go as our new user to create standard folders profile and put the server auto-shutdown script in its startup - C: \ Users \ shut-user \ AppData \ Roaming \ Microsoft \ Windows \ Start Menu \ Programs \ Startup.

Now we need to configure automatic login rdp user to perform remote shutdown. Moreover, the user must enter the server without asking for a username and password. By regular means rdp windows client cannot do this. Even if you save the settings, you will need to enter the password again when transferring the settings to another computer. It didn't work for me.

I've tried using the old ported version of rdp 5.2. it latest version, where the encrypted password could be stored in the settings file. But when transferring this file to another computer, a window with a password was still popped up. It was not possible to achieve complete automatism.

But a solution was found. There is an interesting project called Remote Desktop Plus, which is an add-on to rdp. With this add-in, you can pass parameters to rdp via the command line, including a username and password. It suits me perfectly. We download the file either from the site of the author of the project, or from mine. I copied this very useful utility just in case. We put it in a folder and create it in the same folder rem-shut.bat file with the following content:

Rdp.exe /v:10.10.5.14 / u: shut-user / p: pass123 / w: 640 / h: 480

All this is enough to perform remote shutdown on windows server... The user needs to transfer 2 files:

  • rdp.exe
  • rem-shut.bat

It is important that they are in the same folder. When the batch file is started, the rdp user will be connected and the shutdown script will be executed. Mission accomplished.

Remote shutdown of linux server

Everything turned out to be much simpler here. A working solution was immediately found that allows you to remotely shutdown any linux server without any problems. The problem is being solved standard means putty. This program can be run from command line with parameters. As parameters, you can specify a file with commands for execution, server address, user and password.

We will prepare everything you need. First, create a simple Text Document shutdown.txt with the following content:

Putty.exe -m shutdown.txt -ssh -P 22 -l root -pw rootpass 10.10.5.15

We transfer 3 files to the user, folded into one folder:

  • putty.exe
  • shutdown.txt
  • serv-rem-shut.bat

Now, when the serv-rem-shut.bat script is run, a console command will be sent to the server over the network to shutdown. No questions will be asked. The server will simply shut down silently.

Conclusion

These simple methods were invented and implemented by me. It is also important to provide access to the local network where the servers live. In my case, openvpn allows you to shutdown computers remotely, even over the Internet.

I am sure there are many other possibilities to shut down the server remotely. I would be glad if in the comments with me someone would share their ideas and experience on this matter.

Online course "DevOps practices and tools"

If you have a desire to learn how to build and maintain highly available and reliable systems, learn how to continuously deliver software, monitor and log web applications, I recommend that you get acquainted with online course "DevOps Practices and Tools" in OTUS. The course is not for beginners, for admission you need basic knowledge of networks and Linux installation to the virtual machine. The training lasts 5 months, after which successful graduates of the course will be able to pass interviews with partners. Check yourself on the entrance test and see the program for details on.

What is DNS?

DNS stands forDomain Name System or Domain Name Service. You specified a name, and DNS substitutes the ip address of the resource that hosts the site. The name in this case is exactly the hostname or IP address. Without DNS, you would have to remember the IP address of every site you want to visit. There are more than 300 million websites on the Internet today, it is absolutely impossible to remember the IP address of the required website.

What is dynamic IP?

How to make a static IP address from a dynamic one?

There is no need to buy a static IP. Use our free Dynamic DNS to resolve dynamic address or a long URL with your resource to easily remember the hostname. Remote monitoring of your home via a webcam on any port or launching your own server at your home with a dynamic IP address - all this is available with the serviceDnsIP ... Once a provider has allocated a dynamic IP, a service such as Dynamic DNS becomes necessary.

When registering on our service, you will receive a domain name. A special client that needs to be downloaded is installed on the user's computer. This client periodically sends information to the DNS server, reporting its IP address. The DynDNS server stores the last IP of the user and, when accessing the custom domain name obtained during registration, redirects the request to this IP.

Private network.

Regular services only offer third-level domain names. This can be awkward. In the presence of an external dynamic IP address, our innovative project allows you to get a domain name of not only the third, but also the first level. By setting special application on computers, a private network will become available to you, in which you will be able to access services or programs using any protocol or port. In this case, no traffic will pass through our server. All information will be transferred between computers directly.

Remote computer and remote desktop.

By using DynDNS Secure service DnsIP allows you to organize a connection to a remote computer through any programs remote access using any port. In this case, you directly contact the remote computer, and our service only informs your programs of the required IP address.

Network monitoring.

Using our service, network monitoring will become available to you. All connected users (their computer names) will be monitored only by you. You will be informed which computer is online and which one is offline.

If any application on remote computer does not respond and there is a need to safely reboot the remote machine, you can do this by pressing a button without using the command line and special firewall settings, and even if the remote network does not have an external IP address. You only need to have an Internet connection.

Auto-pressing the button for free access when using Yota.

If you use free Internet access from the "Yota" provider, the connection is blocked once a day, and a window appears in the browser with a proposal to continue at a slow speed. This is extremely inconvenient when using remote access to this computer... In this case, it is enough to install ourfree programand it will restore internet access within minutes. This option is available without registering a user on our website. In this case, the program only needs to be installed, no settings need to be made.

At any time, you can find out the IP address of your resource.

At your service is the page http://dns-free.com/dns2ip.php?dns=xxxxxxx, where xxxxxxx is the domain name in the DnsIP system. Use it to organize links to your resource using the dynamic dns system. Or add to favorites, and with one click find out the current ip of your resource. Or enter manually in the form on the same

What is DNS?

DNS stands forDomain Name System or Domain Name Service. You specified a name, and DNS substitutes the ip address of the resource that hosts the site. The name in this case is exactly the hostname or IP address. Without DNS, you would have to remember the IP address of every site you want to visit. There are more than 300 million websites on the Internet today, it is absolutely impossible to remember the IP address of the required website.

What is dynamic IP?

How to make a static IP address from a dynamic one?

There is no need to buy a static IP. Use our free Dynamic DNS to match a dynamic address or long URL to your resource to easily remember your hostname. Remote monitoring of your home via a webcam on any port or launching your own server at your home with a dynamic IP address - all this is available with the serviceDnsIP ... Once a provider has allocated a dynamic IP, a service such as Dynamic DNS becomes necessary.

When registering on our service, you will receive a domain name. A special client that needs to be downloaded is installed on the user's computer. This client periodically sends information to the DNS server, reporting its IP address. The DynDNS server stores the last IP of the user and, when accessing the custom domain name obtained during registration, redirects the request to this IP.

Private network.

Regular services only offer third-level domain names. This can be awkward. In the presence of an external dynamic IP address, our innovative project allows you to get a domain name not only of the third, but also of the first level. By installing a special application on computers, a private network will become available to you, in which you will be able to access services or programs using any protocol or port. In this case, no traffic will pass through our server. All information will be transferred between computers directly.

Remote computer and remote desktop.

By using DynDNS Secure service DnsIP allows you to organize a connection to a remote computer through any remote access program using any port. In this case, you directly contact the remote computer, and our service only informs your programs of the required IP address.

Network monitoring.

Using our service, network monitoring will become available to you. All connected users (their computer names) will be monitored only by you. You will be informed which computer is online and which one is offline.

If any application on the remote computer does not respond and there is a need to safely reboot the remote machine, you can do this by pressing a button without using the command line and special firewall settings, and even if the remote network does not have an external IP address. It is enough just to have an Internet connection.

Auto-pressing the button for free access when using Yota.

If you use free Internet access from the "Yota" provider, the connection is blocked once a day, and a window appears in the browser with a proposal to continue at a slow speed. This is extremely inconvenient when using remote access to this computer. In this case, it is enough to install ourfree programand it will restore internet access within minutes. This option is available without registering a user on our website. In this case, the program only needs to be installed, no settings need to be made.

At any time, you can find out the IP address of your resource.

At your service is the page http://dns-free.com/dns2ip.php?dns=xxxxxxx, where xxxxxxx is the domain name in the DnsIP system. Use it to organize links to your resource using the dynamic dns system. Or add to favorites, and with one click find out the current ip of your resource. Or enter manually in the form on the same

Working with remote computers usually comes down to the exchange of data - files, licenses or working together with projects. In some cases, more close interaction with the system may be required, for example, setting parameters, installing programs and updates, or other actions. In this article, we will talk about how to reboot a remote machine over a local or wide area network.

There are several ways to reboot remote computers, but there are only two main ones. The first one involves the use of third-party software and is suitable for working with any machine. The second one can only be used to reboot the PC in the local network. Next, we will analyze both options in detail.

Option 1: Internet

As mentioned earlier, this method will help you perform the operation regardless of which network the PC is connected to - local or global. TeamViewer is perfect for our purposes.

This software allows you to manage all processes on a remote machine - work with files, system settings and the registry, depending on the level of rights account... In order for TeamViewer to be able to fully restart Windows, a preliminary configuration must be done.


An example of using the program:


Option 2: Local network

Above, we described how to restart a computer on a local network with using TeamViewer, but for such cases, Windows also has its own, very convenient tool. Its advantage is that the required operation can be performed quickly and without starting. additional programs... To do this, we will create a script file, when launched, the actions we need will be performed.

Now let's create the promised script file.


Conclusion

Interacting with remote computers at the user level is not difficult, especially if you have the necessary knowledge. The main thing here is understanding that all PCs work the same, regardless of whether they are on your desk or in another room. It is enough to send the required command.

What is DNS?

DNS stands forDomain Name System or Domain Name Service. You specified a name, and DNS substitutes the ip address of the resource that hosts the site. The name in this case is exactly the hostname or IP address. Without DNS, you would have to remember the IP address of every site you want to visit. There are more than 300 million websites on the Internet today, it is absolutely impossible to remember the IP address of the required website.

What is dynamic IP?

How to make a static IP address from a dynamic one?

There is no need to buy a static IP. Use our free Dynamic DNS to match a dynamic address or long URL to your resource to easily remember your hostname. Remote monitoring of your home via a webcam on any port or launching your own server at your home with a dynamic IP address - all this is available with the serviceDnsIP ... Once a provider has allocated a dynamic IP, a service such as Dynamic DNS becomes necessary.

When registering on our service, you will receive a domain name. A special client that needs to be downloaded is installed on the user's computer. This client periodically sends information to the DNS server, reporting its IP address. The DynDNS server stores the last IP of the user and, when accessing the custom domain name obtained during registration, redirects the request to this IP.

Private network.

Regular services only offer third-level domain names. This can be awkward. In the presence of an external dynamic IP address, our innovative project allows you to get a domain name not only of the third, but also of the first level. By installing a special application on computers, a private network will become available to you, in which you will be able to access services or programs using any protocol or port. In this case, no traffic will pass through our server. All information will be transferred between computers directly.

Remote computer and remote desktop.

By using DynDNS Secure service DnsIP allows you to organize a connection to a remote computer through any remote access program using any port. In this case, you directly contact the remote computer, and our service only informs your programs of the required IP address.

Network monitoring.

Using our service, network monitoring will become available to you. All connected users (their computer names) will be monitored only by you. You will be informed which computer is online and which one is offline.

If any application on the remote computer does not respond and there is a need to safely reboot the remote machine, you can do this by pressing a button without using the command line and special firewall settings, and even if the remote network does not have an external IP address. It is enough just to have an Internet connection.

Auto-pressing the button for free access when using Yota.

If you use free Internet access from the "Yota" provider, the connection is blocked once a day, and a window appears in the browser with a proposal to continue at a slow speed. This is extremely inconvenient when using remote access to this computer. In this case, it is enough to install ourfree programand it will restore internet access within minutes. This option is available without registering a user on our website. In this case, the program only needs to be installed, no settings need to be made.

At any time, you can find out the IP address of your resource.

At your service is the page http://dns-free.com/dns2ip.php?dns=xxxxxxx, where xxxxxxx is the domain name in the DnsIP system. Use it to organize links to your resource using the dynamic dns system. Or add to favorites, and with one click find out the current ip of your resource. Or enter manually in the form on the same


Top