0

Is there a way to signal windows 2000 to shutdown when a specific program closes? I tried doing it by scheduling a task but couldn't find the shutdown executable, apparently it's only include starting in windows 2003. My next thoughts were with a batch file but I couldn't find any documentation on the command to use.

Zach
  • 31
  • 3
  • 1
    Intriguing. There's really no shutdown command? I seem to remember having a shutdown command in NT and 2000 is more or less just NT. – struthersneil Aug 11 '17 at 00:21
  • 1
    But also what are you doing with Windows 2000? Is it military, medical, or financial? – struthersneil Aug 11 '17 at 00:22
  • Unfortunately off-topic for StackOverflow. Probably best to ask on ServerFault. That said: Windows Server 2000 is well beyond end-of-life, as is Server 2003 and Server 2008. – David Makogon Aug 11 '17 at 00:29
  • 2
    shutdown.exe might still be available for download from the MS web site, e.g., as part of the Windows 2000 resource kit or one of the other download packages. You could always write your own executable that calls InitiateSystemShutdown - provided you can find a compatible compiler, that is. Or you could try psshutdown, if you can still download older versions you might find one that is Windows 2000 compatible. – Harry Johnston Aug 11 '17 at 02:59
  • 1
    @struthersneil - military, medical, financial, or *nuclear reactor* ? :) – selbie Aug 11 '17 at 06:02
  • 1
    @struthersneil financial – Zach Aug 11 '17 at 16:19
  • Is this a physical device or a VM? In other words, Is there a hypervisor in the mix? – David T. Macknet Aug 12 '17 at 22:20
  • @DavidT.Macknet It's a Windows 2000 VM using virtualbox running on Windows 10. – Zach Aug 13 '17 at 00:53
  • Gotcha. So, here's a thought: can you establish something which would monitor your process from the Windows 10 environment & then terminate the VM & restart it? If you're not storing state information on there, it shouldn't do any harm to simply kill it and restart from whatever point - no need for a clean shutdown, in other words. – David T. Macknet Aug 13 '17 at 03:08
  • Maybe have a look at http://www.virtualbox.org/manual/ch08.html#vboxmanage-guestcontrol and see if you can make something of it. Looks like you can use it to start a process on the virtualbox and wait for it to exit, in which case you can do something else in a loop or what have you. – David T. Macknet Aug 13 '17 at 03:17
  • @DavidT.Macknet I actually did something like that with a C program when the host was linux with windows 10 running inside of it. I guess if I enable bash then I'd be able to do the same thing. – Zach Aug 14 '17 at 03:32

1 Answers1

0

To summarize the comments & further information therein, this question is closer to the following:

How can I monitor a process on a Windows 2000 VM, running in VirtualBox, so that I can kill off the VM when the process I care about falls over?

Working from there, something like http://www.virtualbox.org/manual/ch08.html#vboxmanage-guestcontrol would be the way to go. Create a process which tells VirtualBox to start your process & then perform the shutdown when that process terminates. You'd essentially be constructing a supervisory process outside of the Win2K environment, however you want to accomplish that, rather than trying to work within the environment itself.

David T. Macknet
  • 3,112
  • 3
  • 27
  • 36
  • I don't think this is particularly different than doing it "from the inside" - actually, it's probably going to be easier from the inside, you already have to have a program running in the guest machine to monitor the process, you can straight call `ExitWindowsEx` when you notice it finished instead of communicating with a program outside the VM to shut it down. – Matteo Italia Aug 15 '17 at 17:25