First let me note that while I denote 8 + 4 in my code as shutdown it's
actually power off + forced. Power off is what I personally mean when I
refer to shutting down a machine and what I desire. But I want to get
that straight before I get into the solution as they aren't the same
thing to Win32Shutdown.
In working with Windows ME my frustration is that 8 + 4 acted like log
off which was all the more interesting because I don't have users set up
on my ME machine. So I started testing all the options of
Win32Shutdown. First I confirmed 0 + 4 which is log off does the same
thing I 8 + 4 is doing. I then tried 2 + 4 or forced reboot and it
worked. Although I could see little use of 1 + 4 or forced shutdown w/o
the power off I tried it as well and found that for some reason it turns
the power off after shutdown. Hey that's what I was looking for. So
for what it's worth it would seem that to power off a ME machine you use
shutdown vs power off parameters in Win32Shutdown.
cj wrote:
If TimeValue(Now) TimeValue(ShutdownTime) Then
Dim WMIService, Computer As Object
WMIService =
GetObject("Winmgmts:{impersonationLevel=impersonat e,(Debug,Shutdown)}")
For Each Computer In WMIService.InstancesOf("Win32_OperatingSystem")
Computer.Win32Shutdown(8 + 4, 0) 'shutdown
Next
End If
My problem is it doesn't work on ME. Well, it prompts me for a
password. I don't use passwords on my old ME pc. Any help would be
appreciated. It's an old pc but it still serves it function and it
would be nice to modify one of my programs on it to shut it down
automatically.