Hello fellow forum members:
To Tony: I realize that asking for a feature in the next version of NASLite+ which allows automated and unattended shutdown from commercially available UPS systems ( I use APCC's with USB interface ) is probably unrealistic as it takes to much code. My second preference would be that NASLite+ is APCI2.0 compatible, so that if I push the power-button on the PC it does a graceful shutdown (just like Windows, if properly chosen in BIOS).
To Moderators: Consider making this a STICKY for NASLite+, NASLITE+ USB, may be even NASLite ( I have NOT tested with the FREE version ).
To all: I have a setup where a Windows PC and the NASLite server hang off the same APCC UPS. Trouble is, although the PC can, NASLite can't shutdown automatically. This means after some time unattended in a power-outage the NASLite server will eventually crash.
Here's my solution. Feel free to use and modify for your needs. I offer no warranties ... it is use AS-IS. And be aware of some limitations. If you are running Microsoft Anti-Spyware (or others') user-intervention may be required to allow the script to run. I have only tested on Windows XP/SP2. You can run this script manually, or incorporate it into your Windows PC shutdown procedure ... on a regular basis using Task Scheduler or in an emergency triggered by your UPS. I have not yet tested the later part, but I believe I can have the APCC UPS execute a script during shutdown. I'll have some time to test that part next week.
Paste the script below into a text file, change name to "nas_shut.vbs", and try it. For safety it performs an "EXIT" as shown ... test it until it works for you then substitute "SHUT" for "
XIT" in SECTION E. Also
DELAY is set pretty high so you can see the action as it happens; 1000 works fine.
When pre-viewing the below I noticed it does not format as well as in my text editor. When you copy/paste you can clean it up ... but make sure you leave the single and double quote-marks as-is, especially in SECTION A.
' --------------------------------------------------------------------
'
' NAS_SHUT.VBS
'
' A script for Windows PC to remotely shutdown NASLite+ via the
' telnet login. Works with NASLite+ USB v1.5 under Windows XP/SP2
' both HomeEdition and Pro. Should work with other versions, even
' NASLite Free.
'
' Make sure to substitute the proper responses in Section A and
' the correct sequence in Section E and F.
'
' Originally 17March2006 by georg for the ServerElements Forum users.
'
' --------------------------------------------------------------------
' --------------------------------------------------------------------
' SECTION A: Some parameters ... for login and the NASLite+ Menu.
' --------------------------------------------------------------------
ServerName = "192.168.1.24" ' Use IP or name here (in quotes).
Username = "admin" ' Current Username
Passwd = "nas" ' Current Password
XIT = "E" ' Used to "EXIT" from NAS. (upper-case E)
YES = "y" ' Used to confirm an option. (lower-case Y)
SHUT = "8" ' Used to SHUTDOWN NAS. (number eight)
DELAY = 2000 ' Minimum 500ms recommended; 1000 works well.
' --------------------------------------------------------------------
' SECTION B: Start a Shell
' --------------------------------------------------------------------
Set WshShell = WScript.CreateObject("WScript.Shell")
' --------------------------------------------------------------------
' SECTION C: Start the TELNET
' --------------------------------------------------------------------
WshShell.Run "telnet " + ServerName
' --------------------------------------------------------------------
' SECTION D: Login. ("Sleep" pauses are needed delays.)
' --------------------------------------------------------------------
WScript.Sleep DELAY
WshShell.SendKeys Username + vbLf
WScript.Sleep DELAY
WshShell.SendKeys Passwd + vbLf
' --------------------------------------------------------------------
' SECTION E: NASLite+ Menu do a SHUTDOWN (or an XIT during testing)
' --------------------------------------------------------------------
WScript.Sleep DELAY
WshShell.SendKeys
XIT + vbLf ' Change XIT to desired option.
' --------------------------------------------------------------------
' SECTION F: Confirm the selection.
' --------------------------------------------------------------------
WScript.Sleep DELAY
WshShell.SendKeys YES + vbLf
' OPTIONAL: (remove the comment tick mark to activate)
' MsgBox "NASLite+ Shutdown Started"
WScript.Quit
Hope this helps someone ...

Georg