Can I restart a Windows server via command line in pfSense

I have a remote computer (Windows Server 2016) that sometimes does not allow access (rdweb) due to random issues. I know what one of them is, and how to fix it locally, but if I’m not there, I can’t do it.
Restarting as we all know is a great way to fix things.

I know how to restart it via command line if I’m logged into the server via RDWeb, but what if I can’t get into that server? I can get into my pfSense box still. It’s a service on the server that stopped, and yes, it’s set to auto restart, but it doesn’t all the time.

This is how I do it if I can get into windows: go to: C:\Windows\system32\cmd.exe
Then type in shutdown -r

Is there a similar option to do a command in pfSense to restart server at IP for example?
Windows server 2016 for whatever that’s worth.


if you can ssh to that ip, you can do it from a shell command in pfsense. There is openssh for windows so install it and test that you can ssh win2016 with your credentials.

Thanks, I guess I’m in over my head with this.

I was wanting something like:
On the pfSense install, go to Diag, command prompt, enter ______

I have seen where I can restart the server from a windows PC, I just couldn’t find where to do it from linux (pfSense) to windows.

My failsafe currently is just to have the server restart every night so that in the event that I’m out of town, I’m only down for a day. I was wanting to improve that down time if I could (easily) by hitting restart on the pfSense box if needed.

Is this a physical or a virtual server? If a physical server like a dell or supermicro then I would setup the IPMI interface and interact with it that way. If a virtual server then you should be able to send a remote restart command from your workstation if you are on the VPN. If not on the VPN then log into a machine that is on the same LAN and then run shutdown /r /m \\pc2

1 Like

Thanks! That code worked from my desktop to the server, I didn’t think about that because I usually VPN in through my phone and then I see the pfSense is online so that it’s a server issue and start my drive into the office. I can use a desktop to VPN too, so this is great.

For me, it would be quicker / easier to send a command through pfSense as I’m usually on my phone. Is there something this easy to send through the firewall?
If not, this was a great piece of advice, as it works, and saves me a trip to the office on the weekends if I need to just hit restart.
I don’t want to install anything else, so this was a very turn key solution.


Edit to answer your question:
It’s a local server, that is a virtual server on my main physical server

Personally, I wouldn’t want my firewall to have that kind of ability with my servers for security reasons. The firewall should only do firewall functions.

To answer your question though, I don’t think there is a way (without installing unsupported packages on your pfsense) you can accomplish that. But, looks like the remote reboot command will do it for ya. Glad to see it working!


I agree with @xMAXIMUSx, but if you invest the time to setup and learn some Ansible you could control almost anything on your network. It’s free too.

OP, install an agent on your Windows server that you can manage from elsewhere. That’s how you do it in the Windows world.

Every server that I buy has an out of band management option that I can access the computer ie ipmi, ilo, idrac that I can restart the computer

I have the Dell idrac but the command provided does the trick too. Maybe that’s easier, I don’t know.

The (my) process is:
Turn on laptop
Connect to network via VPN (firewall)
Open command prompt on laptop
Open saved notepad file with command line saved
Paste in cmd
Wait 5 minutes and server is back up and running

The above is for when I’m not at the office and need to restart the server.

I actually just need to restart a service that turns off sometimes, but I’m not running a big service. I just need something that works and is quick.

The auto restart on the service doesn’t always restart it for whatever reason. I’m not an IT pro, just a user.

If something is easier than copy and paste into cmd let me know, but that’s straight forward without any need to install it change anything on my network.

Thanks for all the ideas and help!

The best thing that can be done is to identify the root cause and come to a resolution. But if you don’t want to have any intervention with checking if your service isn’t running or getting phone calls about it then I would create a powershell script to check the service and if it’s down then restart the service then check to see if the service is running and if not then reboot the server. Once the script works as intended then create a scheduled task to run the script however often you want to check the service.

I’m an automation guy and I despise having to do things manually :slightly_smiling_face:. If you want help going down this path let me know.

Thanks for the offer, and the info, but I think it may be harder than I want to do. I’m not a computer guy.

Automatic is great, but this is an error that happens I’ll say once every couple of months. Usually when I’m not at the office as fate would have it. That’s why I needed an easy way to restart the server remotely. Not the best for everyone I know.
I know how to fix it locally, log into server, and go to services, find the one that randomly stopped and didn’t restart by itself like it’s supposed to, and manually hit restart on that service. It’s quick enough at the office, and the whole server restart works remotely now.

If you have a very quick command for all of that, to restart a stopped service, that’s nice of you, but if you don’t, please don’t spend any time on it…

The idea of automating has been stuck in my head, so I turned to Google and found this link with a few pointers. I wanted to provide this incase anyone else wanted it…