Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run powershell script. #20

Open
cj-arnas-navasinskas opened this issue Oct 22, 2018 · 2 comments
Open

Can't run powershell script. #20

cj-arnas-navasinskas opened this issue Oct 22, 2018 · 2 comments
Assignees

Comments

@cj-arnas-navasinskas
Copy link

cj-arnas-navasinskas commented Oct 22, 2018

Hi,

I am trying to run powershell script:

	{
		"Operation" : "playvideo",
		"Command" : "powershell.exe -file D:\\hassio\\firefoxOnDesktop.ps1",
		"Default" : false
	}

It works when opening from usual cmd, but not via sleep on lan tool.

@SR-G SR-G self-assigned this Jun 28, 2021
@t4ce
Copy link

t4ce commented Nov 21, 2021

install script for start + run service (powershell)
on 64bit amd windows 11, put this into a bat file, have nssm and sol in the same folder

call nssm.exe install SleepOnLan sol.exe
call powershell -Command "& {Start-Service 'SleepOnLan';}"

protip: execute the sol.exe once manually to add firewall

i just want to add this here cause it will help some users but
to be honest it is not a reply to Arnasnn's Question, but his question is unreleated anyway. please delete.

@sergeolkhovik
Copy link

I have similar thing:

  "Commands" : [{
     "Operation" : "sleep",
     "Command" : "c:\\bin\\psshutdown.exe -d -t 3 -v 0",
     "Default" : true
   }, {
     "Operation" : "killgames",
     "Command" : "cmd.exe /c d:\\home\\Serge\\bin\\vanya-killgames-do.cmd",
     "Default" : false
   }]

Sleep works OK, but games killer doesn't. CURL output:

<?xml version="1.0" encoding="UTF-8"?>
<result>
  <operation>killgames</operation>
  <successful>true</successful>
</result>% 

and the log:

2022-07-03 14:09:30 INFO  listener_http.go:221 Executing [killgames]
2022-07-03 14:09:30 INFO  sleeper_windows.go:35 Executing operation [killgames], type[external], command [cmd.exe /c d:\home\Serge\bin\vanya-killgames-do.cmd]
2022-07-03 14:09:30 INFO  sleeper_windows.go:46 Sleep implementation [windows], sleep command is [%!(EXTRA string=cmd.exe /c d:\home\Serge\bin\vanya-killgames-do.cmd, string=])
2022-07-03 14:09:30 ERROR  sleeper_windows.go:49 Can't execute command [cmd.exe /c d:\home\Serge\bin\vanya-killgames-do.cmd] : exit status 1

Doesn't matter if I fun simply my cmd file as a command or via cmd.exe /c...
Looks like it works if full path is specified (C:Windows\System32\cmd.exe):

⇨ http server started on [::]:8009
2022-07-03 14:20:19 INFO  listener_http.go:221 Executing [killgames]
2022-07-03 14:20:19 INFO  sleeper_windows.go:35 Executing operation [killgames], type[external], command [C:\Windows\System32\cmd.exe /c d:\home\Serge\bin\vanya-killgames.cmd]
2022-07-03 14:20:19 INFO  sleeper_windows.go:46 Sleep implementation [windows], sleep command is [%!(EXTRA string=C:\Windows\System32\cmd.exe /c d:\home\Serge\bin\vanya-killgames.cmd, string=])
2022-07-03 14:20:20 INFO  sleeper_windows.go:51 Command correctly executed

(and I added full path to taskkill inside my cmd script as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants