473,386 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ExitWindows and InitiateSystemShutdown.

In some cases we need to programmatically restart/shutdown a local or remote
machine. I know that there is a Windows 2000 Resource Kit that contains a
Shutdown.exe that does just this; however, we cannot get approval to
purchase the resource kit. Therefore we are looking to programmatically
shutdown/restart Windows. We've looked at ExitWindows(Ex) and
InitiateSystemShutdown(Ex). We've made sure to adjust all the priveleges
accordingliy before invoking these functions and all functions return TRUE
indicating success. The problem that we are having is that the machine
takes a long time (on the order of 30+ minutes) to shutdown/restart, or
sometimes never at all. We do not see the "It is now safe to poweroff"
screen. All we see is a blank blue screen. I have not been able to find
anything on the web that can suggest a solution. Do you have any ideas?

Thanks in advance,
Aaron W. Smith
Jun 13 '06 #1
2 3086
"John Smith" wrote:
In some cases we need to programmatically restart/shutdown a local or remote
machine. I know that there is a Windows 2000 Resource Kit that contains a
Shutdown.exe that does just this; however, we cannot get approval to
purchase the resource kit. Therefore we are looking to programmatically
shutdown/restart Windows. We've looked at ExitWindows(Ex) and
InitiateSystemShutdown(Ex). We've made sure to adjust all the priveleges
accordingliy before invoking these functions and all functions return TRUE
indicating success. The problem that we are having is that the machine
takes a long time (on the order of 30+ minutes) to shutdown/restart, or
sometimes never at all. We do not see the "It is now safe to poweroff"
screen. All we see is a blank blue screen. I have not been able to find
anything on the web that can suggest a solution. Do you have any ideas?

Thanks in advance,
Aaron W. Smith


InitiateSystemShutdown(Ex) returns TRUE if it succeeded in starting the
shutdown, but that doesn't guarantee that the shutdown won't be aborted,
delayed, etc.

My first guess is that some process is refusing to close when it receives
the shutdown notification. You can try calling InitiateSystemShutdownEx with
the bForceAppsClosed parameter set to TRUE and seeing if that helps.

I've also seen where adjusting a service's shutdown order with
SetProcessShutdownParameters can cause problems if you cause a service to
shut down before services depending on it can close. I've only seen this
once, though.

Sean
Jun 13 '06 #2
Thanks Sean for the quick response. We have tried setthge the
bForceAppsClosed and TRUE and unfortunately that did not help things.
However, your second suggest about the order in which services shutdown may
have an impact. We do have a couple of services that are running that
depend on each other. We have not modified the way these shutdown via
SetProcessShutdownParameters (or any other way programmatically for that
matter.) Is Windows capable of shutting these down in a safe order or
should we look into SetProcessShutdownParameters?

Aaron W. Smith

"Sean M. DonCarlos" <se********@newsgroups.nospam> wrote in message
news:B6**********************************@microsof t.com...
"John Smith" wrote:
In some cases we need to programmatically restart/shutdown a local or remote machine. I know that there is a Windows 2000 Resource Kit that contains a Shutdown.exe that does just this; however, we cannot get approval to
purchase the resource kit. Therefore we are looking to programmatically
shutdown/restart Windows. We've looked at ExitWindows(Ex) and
InitiateSystemShutdown(Ex). We've made sure to adjust all the priveleges accordingliy before invoking these functions and all functions return TRUE indicating success. The problem that we are having is that the machine
takes a long time (on the order of 30+ minutes) to shutdown/restart, or
sometimes never at all. We do not see the "It is now safe to poweroff"
screen. All we see is a blank blue screen. I have not been able to find anything on the web that can suggest a solution. Do you have any ideas?

Thanks in advance,
Aaron W. Smith
InitiateSystemShutdown(Ex) returns TRUE if it succeeded in starting the
shutdown, but that doesn't guarantee that the shutdown won't be aborted,
delayed, etc.

My first guess is that some process is refusing to close when it receives
the shutdown notification. You can try calling InitiateSystemShutdownEx

with the bForceAppsClosed parameter set to TRUE and seeing if that helps.

I've also seen where adjusting a service's shutdown order with
SetProcessShutdownParameters can cause problems if you cause a service to
shut down before services depending on it can close. I've only seen this
once, though.

Sean

Jun 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mrzt | last post by:
the following codes won't work. ============================== using System; using System.Runtime; using System.Runtime.InteropServices; namespace Shutdown { /// <summary> /// Class1...
13
by: Bredal Jensen | last post by:
I'm thinking of soething equivalent to "exitwindows"
5
by: Bredal Jensen | last post by:
My apllication needs to shut down windows XP when users are done with it and i have therefore p/Invoked exitwindows as suggested from this newsgroup.(My earlier posting) Can soeone tell me...
1
by: Nedeljko Tadic | last post by:
How do I exit windows from c#, without using ExsitWindows API function???
6
by: Mr Newbie | last post by:
Whatever I do I cant programatically make my machine shutdown. I am using the following class and have tried both thte ExitWindowsEx and InititateSystemShutdownEx shared functions Neither seem to...
1
by: | last post by:
Hello, i have problem with rebooting windows Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As...
2
by: Podi | last post by:
I have ctypes version 0.9.6 and Python 2.4.2 running on Windows XP Professional. When I tried to use some functions in the Advapi32.dll, some functions are available and some are not. Is this a...
17
sashi
by: sashi | last post by:
Hi everyone, Here are some VB related tips & tricks, hope it helps. Good luck & Take care. Important This thread is closed for general posting. Please start a new thread if you have a...
18
by: Lee Kok Onn | last post by:
Hi, I have written the following code in vb2005 to reboot the windows, but end with error "ExitWindows(EWX_REBOOT, &HFFFFFFFF)", call to PInvoke function 'shutdown!shutdown.Form1::ExitWindows'...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.