Giter Club home page Giter Club logo

remote-shutdown-pc's Introduction

Remote Shutdown Manager

The project is a windows application, which gives an ability to shutdown, suspend, hibernate PC, restart or turn screen off using HTTP GET request.

The application stays in a system tray area, where you can trigger custom command shutdown as well.

The program has following settings:

  1. Load program at Windows startup
  2. Security code
  3. System tray menu customization
  4. Custom port number

Screenshots:

Icon

Menu

Settings

Example of remote requests:

  1. No code, default command

http://remote-host-name:5001/

  1. Secret code, default command

http://remote-host-name:5001/secret/

  1. Secret code custom command:
  1. Delaying a command

It is possible to delay a command. When delayed, a dialog will be shown, allowing the user to abort the operation. Simply add the parameter ?delay={seconds} to your get request

The application can be easily used with IFTTT or AutoVoice to shutdown PC remotely.

Build status

remote-shutdown-pc's People

Contributors

barberouss avatar dependabot[bot] avatar dgrv avatar karpach avatar zleqiteclipse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

remote-shutdown-pc's Issues

Won't run

don't know if i'm doing something wrong, but it gives an exception error when trying to run, maybe some missing dependency ? your other remote shudown app works fine..

I even tried putting the files in the path specified in the error log: C:\projects\remote-controller

error log below:

2020-04-30 09:03:08.5664|FATAL|Karpach.Remote.Commander.Program|Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ControllerApplicationContext (ReflectionActivator), Services = [Karpach.Remote.Commander.ControllerApplicationContext], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Factory, Factory, Karpach.Remote.Commander.Interfaces.ICommandsSettings, Factory)' on type 'ControllerApplicationContext'. ---> Cannot cast the underlying exported value of type 'Karpach.Remote.Commands.CommandsContainer (ContractName="Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer")' to type 'Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer'. (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Factory, Factory, Karpach.Remote.Commander.Interfaces.ICommandsSettings, Factory)' on type 'ControllerApplicationContext'. ---> Cannot cast the underlying exported value of type 'Karpach.Remote.Commands.CommandsContainer (ContractName="Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer")' to type 'Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer'. (See inner exception for details.) ---> System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'Karpach.Remote.Commands.CommandsContainer (ContractName="Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer")' to type 'Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer'.
at System.ComponentModel.Composition.ExportServices.CastExportedValue[T](ICompositionElement element, Object exportedValue)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValuesCore[T](String contractName)
at Karpach.Remote.Commander.ControllerApplicationContext..ctor(Factory settingsFormFactory, Factory hostHelperFactory, ICommandsSettings commandsSettings, Factory commandManagerFactory) in C:\projects\remote-controller\Karpach.Remote.Commander\ControllerApplicationContext.cs:line 38
at lambda_method(Closure , Object[] )
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable1 parameters)
at Karpach.Remote.Commander.Program.Main() in C:\projects\remote-controller\Karpach.Remote.Commander\Program.cs:line 32
2020-04-30 09:03:18.5675|FATAL|Karpach.Remote.Commander.Program|Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ControllerApplicationContext (ReflectionActivator), Services = [Karpach.Remote.Commander.ControllerApplicationContext], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Factory, Factory, Karpach.Remote.Commander.Interfaces.ICommandsSettings, Factory)' on type 'ControllerApplicationContext'. ---> Cannot cast the underlying exported value of type 'Karpach.Remote.Commands.CommandsContainer (ContractName="Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer")' to type 'Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer'. (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Factory, Factory, Karpach.Remote.Commander.Interfaces.ICommandsSettings, Factory)' on type 'ControllerApplicationContext'. ---> Cannot cast the underlying exported value of type 'Karpach.Remote.Commands.CommandsContainer (ContractName="Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer")' to type 'Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer'. (See inner exception for details.) ---> System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'Karpach.Remote.Commands.CommandsContainer (ContractName="Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer")' to type 'Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer'.
at System.ComponentModel.Composition.ExportServices.CastExportedValue[T](ICompositionElement element, Object exportedValue)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValuesCore[T](String contractName)
at Karpach.Remote.Commander.ControllerApplicationContext..ctor(Factory settingsFormFactory, Factory hostHelperFactory, ICommandsSettings commandsSettings, Factory commandManagerFactory) in C:\projects\remote-controller\Karpach.Remote.Commander\ControllerApplicationContext.cs:line 38
at lambda_method(Closure , Object[] )
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable1 parameters)
at Karpach.Remote.Commander.Program.Main() in C:\projects\remote-controller\Karpach.Remote.Commander\Program.cs:line 32
2020-04-30 09:13:38.4157|FATAL|Karpach.Remote.Commander.Program|Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ControllerApplicationContext (ReflectionActivator), Services = [Karpach.Remote.Commander.ControllerApplicationContext], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Factory, Factory, Karpach.Remote.Commander.Interfaces.ICommandsSettings, Factory)' on type 'ControllerApplicationContext'. ---> Cannot cast the underlying exported value of type 'Karpach.Remote.Commands.CommandsContainer (ContractName="Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer")' to type 'Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer'. (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Factory, Factory, Karpach.Remote.Commander.Interfaces.ICommandsSettings, Factory)' on type 'ControllerApplicationContext'. ---> Cannot cast the underlying exported value of type 'Karpach.Remote.Commands.CommandsContainer (ContractName="Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer")' to type 'Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer'. (See inner exception for details.) ---> System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'Karpach.Remote.Commands.CommandsContainer (ContractName="Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer")' to type 'Karpach.Remote.Commands.Interfaces.IRemoteCommandContainer'.
at System.ComponentModel.Composition.ExportServices.CastExportedValue[T](ICompositionElement element, Object exportedValue)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValuesCore[T](String contractName)
at Karpach.Remote.Commander.ControllerApplicationContext..ctor(Factory settingsFormFactory, Factory hostHelperFactory, ICommandsSettings commandsSettings, Factory commandManagerFactory) in C:\projects\remote-controller\Karpach.Remote.Commander\ControllerApplicationContext.cs:line 38
at lambda_method(Closure , Object[] )
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable1 parameters)
at Karpach.Remote.Commander.Program.Main() in C:\projects\remote-controller\Karpach.Remote.Commander\Program.cs:line 32

希望能运行bat批处理文件功能

希望在命令行处能输入bat批处理文件名,手机遥控执行这个bat批处理文件。
想在休眠或关机前执行一下其他任务,我在bat中加入休眠或关机命令,
谢谢作者的小工具!

Add option to Sleep?

Would it be possible to have an option that puts the PC in Sleep/Hybrid Sleep mode as an alternative to Hibernation?

Help

Hi,
Really impressed with this project it is exactly what I need. However, i have no idea how to get started. could you help, please?

Sam

Compile for older systems, Windows XP

First, this is a great piece of software, super important feature for places with frequent power issues. Perhaps this is the wrong place for this question, but if someone could point me towards compiling this for old machines (they exist as VMs only now), it would be great to be able to shut them down like more modern machines.

Regards,
Jordan

PC fails to wake-up for client backup if suspended with this app

My PC is automatically backed up each night with the client backup feature of Windows Server 2012 R2 Essentials.

If the PC is suspended via the Windows toolbar menu, it automatically resumes at the scheduled backup time and the backup job is executed.
If the PC is suspended via the remote-shutdown-pc tool, it doesn't resume and the backup job isn't executed.

Why is the suspend-behavior different, and is there a way to also have the PC resume for the backup when suspended via the tool?

Server Won't Work

Hello,
With version remote-shutdown-pc-v1.0.40 the server won't work anymore.
Could you check?
Bye
Stefano

Shutdown when user isn't logged in

Hi, is there a way to shut down the pc when a user isn't logged in or when it's on the lock screen. I'm using it with alongside home assistant for power outage automations.

Can't run exe, missing frameworks for .NET.

Trying to run the latest 1.1.2 exe I keep getting this error:

---------------------------
Karpach.RemoteShutdown.Controller.exe
---------------------------
To run this application, you must install missing frameworks for .NET.

Would you like to download it now?

Chosing yes doesn't help. There doesn't start any download.
It seems I have installed these versions:

PS C:\WINDOWS\system32> Get-STDotNetVersion


ComputerName : localhost
>=4.x        : 4.8 or later
v4\Client    : Installed
v4\Full      : Installed
v3.5         : Installed
v3.0         : Installed
v2.0.50727   : Installed
v1.1.4322    : Not installed (no key)

I've downloaded the 1.1.1, too, but without success (same error).
What else do I need ?

Server not working

I compiled app via VS 2019 without errors but when I run it the server is not created, there is no port that app is listening on. What could be the problerm, and how to debug it?

Force shutdown...

Is it possible to have a checkbox to force the shutdown/reboot, because if there are some open programs in the background the pc will not shutdown/reboot.

How to configure HA and the target computer?

What is the syntax to use the “Turn off screen” command please? * http://remote-host-name:5001/turnoffscreen? …/turn-off-screen? other?

Other question, do I have to open the 5001 port on my PC firewall? Because for now nothing works sadly

Is there anything to configure first in configuration.yaml to use curl commands? I have this error: Logger: homeassistant.components.command_line
Source: components/command_line/init.py:43
Integration: command_line (documentation, issues)
First occurred: 19:19:09 (2 occurrences)
Last logged: 19:20:24

Timeout for command: curl http://192.168.1.29:5001/test/turn-screen-off

Thanks for you help

noob here, no executables

Any chance you can start off how compile these into executables for windows? Can't find any exe or installer inside here.

Unable to Run

Hi,

Firstly thank you for providing this software.

I'm having an issue running the application which fails with an incompatibility error. I've tried both the oldest release and the newest both of which fail with the same error. I'm running Windows 7 32bit I know that's not much to go on but any ideas what may be stopping it from running?

Kind regards

Mark

Feature requests

Great app, congratulations. Optimal operation, with simple Curl instruction. If you added run as a service and send wol, it would already be perfect. His combined uses with VirtualHere gives a lot of options in a simple way.

Enhancement Request: Provide Power Status and Events

This is a great tool and I'm using it in conjunction with TAustin's Smartthings Edge driver with great success. Thank you!

Clients like TAustin's and end users like myself could benefit from having insight into power management on the system. As it stands, I'm only able to control the PC power state (and thus the associated devices in my scheme) when it is fully active (e.g., not suspended or pending user log in). The ability to learn about events and the current power management parameters would greatly increase the utility that's already here.

Here's a potential approach:

  1. Subscribe to Win32 power events: suspend, hibernate, shut down as well as resume from suspend/hibernate, and power up as well as changes to the active power plan (not sure if there's a Win32 event for that last one). There may be more such events of interest, like starting and ending versions of these and even one indicating that the system is up but pending user log in.
  2. As was suggested earlier, provide a setting such that the system can WoL from a suspended state.
  3. Respond to shutdown and other requests with success/failure or, better, a status code.
  4. Support an event subscription model to report PC power events to network clients. Client's like TAustin's PC Control Driver would subscribe to relevant RSM power events.

With these in place, clients like the PC controller can know what’s going on and a) have the ability to reflect that status to their clients in turn as well as b) issue more appropriate power events in more situations.

These changes would obviously increase the scope of your tool beyond the handling shutdown requests and basic monitoring into a more complete solution, yet still in the realm of supporting shutdown and power state monitoring.

Thanks again for this tool and for your consideration of these or even better possibilities.

This app fails to start on Windows startup

I can see there is remote-shutdown-pc on the startup page, but the app won't start actually and there is no icon on system tray, so non of the commands work.

I am on Windows 11 22H2.

The app is v1.1.2

image

Hide tray icon, or require password to exit the app

I guess it's more of a feature request than an issue..

But I want to install this on my kids PC, but he is smart enough to just exit the app.. can we make it so a password needs to be entered to exit the app? Or simply hide the tray icon so he has no idea that it is running?

Feature request: Add SSL

Having a secret is good, but can easily be snooped as its in plain-text. Adding a certificate would close that loop hole.

I can imagine if this was distributed as-is on a school network, and a student got the secret-code, many laughs would be had :)

As it is Windows, the certificate can be stored in the local machines certificate store, which can then be updated via other automated means outside of the remit of this app. However, in order for it to be automated, the certificate needs to be able to be picked at startup, or part of a registry entry with the thumbprint.

Thank you for this useful tool 💯

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.