shutdown TrueNAS via cmd script on Windows

PrieserMax

Cadet
Joined
Jun 4, 2023
Messages
2
Hello dear TrueNAS-community,

I am trying to shutdown TrueNAS via CMD from a Windows host.
I have an APC USV which is connected to my Host running Windows server with Hyper-V.
I have APC PowerChute Serial Shutdown installed, where I can put a script for shutting down other computers etc.
In my script I am shutting down another Windows machine and try to shutdown TrueNAS.

In there I have the following content:
ipconfig /flushdns net use \\PCXY\IPC$ /user:DOMAIN\USER PASSWORD shutdown /s /m \\PCXY /t 30 /c "Dieser PC wird in 30 Sekunden wegen eines Stromausfalls heruntergefahren" /f putty.exe -ssh sshshutdown@IPADDRESS -pw PASSWORT -m "C:\Program Files\APC\PowerChute Serial Shutdown\agent\cmdfiles\NASXYshutdown.txt"

content of NAS01shutdown.txt:
sudo shutdown -p now [rA*(A8Aho_J#r$QJ#uJ exit

-> I guess the passing through of the password is the problem, but I don't know how to solve it

The user is member of the sshd and the check for allow sudo is checked.

Thanks in advance
Greetings
Max
 

PrieserMax

Cadet
Joined
Jun 4, 2023
Messages
2
Mainboard: Asrock Z77 Extreme 9
CPU: Intel Core i3-3240
RAM: 2 x 8GB DDR3
SSD: 120GB OCZ SSD for boot
HDDs: RAID-ZFS2 4 x WD 4TB, 4 x Toshiba 4TB
 

unseen

Contributor
Joined
Aug 25, 2017
Messages
103
Use public key authentication for the user instead, then you don't have to specify a password.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
Top