Which API call are you using? You need to call ExitWindowsEx() (not just ExitWindows()) with the EWX_REBOOT parameter.
Main Topics
Browse All TopicsCan anyone tell me how to force win2k to restart (reboot) either from the command line or in VB?
I ahve been trying to do it from vb using an API call but it only logs the user off and doesn't reboot the machine.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Here's the answer ...
In order to programmatically reboot a Windows NT or Windows 2000 system, the process requires the SE_SHUTDOWN_NAME privilege. By default, Visual Basic applications do not have this privilege and therefore will not reboot the machine.
Visit the following link for details and a solution on how to get this to work in VB
http://support.microsoft.c
PS Some of the APIs have the wrong parameters and are declared private when they should be public. With some fiddling I got it to work fine though.
Will ask for a deletion of this question
You're so so funny man ;-))) LOL, you ask a question. You get valid comments for answer (not full answers but both valid) and you provide the answer yourself just sometimes after, rejecting a valid answer (command line)
Next time I have to ask a question, I'll cheap like you do, ask, get answers and then ask dor deletion in order to get my points back,
You're so so funny ;-) LOLAROTF
Fair player, certainly not !
mtoadmin
mtoadmin: Sorry. I'm not trying to get answers for nothing. Actually It's just that I found my answer before reading your comment and it meets all the requirements I asked for while your's doesn't.
I needed something built-in or some VB (to add to my program). The answer you suggested is not built into win2k if I understand correctly. It's a program I must download, install, and trust. It just didn't meet my requirements. I didn't want to have one more executable to carry around and worry about, just a built-in command line command or some VB I could add to my exe.
And as for porting it ... I am not a VB or C++ programmer. I would have had to ask *another* question just for that ;)
Oh, and pjknibb's answer does *not* work for the reasons explained in my "answer".
So while your answer is good, it's not what I asked for. (though admitedly I should have been clearer as to what I meant by command line).
Business Accounts
Answer for Membership
by: mtoadminPosted on 2000-07-05 at 01:55:42ID: 3183350
There is one in the resource kit: shutdown.exe
down.html
But more interresting is the following:
http://crv.mp3car.com/shut
Which comes with a source code in c++, you can probably port it to vb.
Beware of the shutdown.exe from the above mentionned link, it doesn't warn by default before shuting down (My machine just when down when I was trying it for you ;-)))
have fun
mtoadmin