Solved

Restart NT. / login

Posted on 2000-03-27
5
231 Views
Last Modified: 2013-11-20
I`m Trying to Restart NT

1)

I get ERROR_ACCESS_DENIED Error.

When Call to:
InitiateSystemShutdown(NULL,NULL,0,TRUE,TRUE)

I`m logged as a member of Administrators Group on this machine.

2)  
  Is it possible to restart the computer in the way that it will not prompt for user and password.

(I want to run automaticaly a program that is in Windows 'StartUp' after restart,
but the problem is that it will not run it till somebody will enter a login/password.)



===========

 
   
 
0
Comment
Question by:TelMic
5 Comments
 
LVL 1

Expert Comment

by:cbeattie
ID: 2661406
TelMic, in order to shutdown windows, use the following function call instead of InitiateSystemShutdown:

1)
ExitWindowsEx(
  UINT uFlags,       // shutdown operation
  NULL   // reserved
);

For the uFlags parameter use one of the following values:
EWX_LOGOFF // Return to login screen
EWX_POWEROFF // logout & powerdown (system must support power-off)
EWX_REBOOT // Logout & Reboot
EWX_SHUTDOWN // Logout to the "Safe to turn off power" screen

I'm not sure how to do #2.  If this works, let me know and I'll resubmit as an answer.
0
 
LVL 4

Accepted Solution

by:
pagladasu earned 50 total points
ID: 2662286
You can enable automatic logon. Follow these steps:

1.Start regedit.exe (Start - Run - regedit)
2.Open the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\Current Version\Winlogon
3.Double click the DefaultDomainName and fill in your domain name
4.Double click the DefaultUserName and fill in login name
5.From Edit menu select New String Value, and enter DefaultPassword as name of value
6.Double click the DefaultPassword and enter in the password
7.From Edit menu select New String Value, and enter AutoAdminLogon as name of value
8.Double click the AutoAdminLogon and set the value to the number 1
9.Close regedit
10.Logoff and you will be automatically logged in again
0
 

Author Comment

by:TelMic
ID: 2675893
cbeattie,

I got an error (using GetLastError)

1314 A required privilege is not held by the client.  ERROR_PRIVILEGE_NOT_HELD
0
 
LVL 1

Expert Comment

by:cbeattie
ID: 2680027
TelMic,

Which flag did you use?  When you got the error?  EWX_POWEROFF, EWX_REBOOT, and EWX_SHUTDOWN require the user to have the SE_SHUTDOWN_NAME privilege, but only if running under Windows NT.

If you use EWX_LOGOFF, you shouldn't get any Privilege errors.  Also, make sure you pass in 0 for the second parameter.

If you want to use one of the other three options, you must first make a call to AdujstTokenPrivileges() to enable the SE_SHUTDOWN_NAME privilege, although I've never run into this situation before.  If you need assistance with this function, let me know and I'll be happy to help out.
0
 
LVL 7

Expert Comment

by:Sasha_Mapa
ID: 2683127
cbeattie,

I`m working on Windows NT,

Yes Please Help me with the AdjustTokenPrivileges();

0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 178
Rewrite URL With Encoded Characters 6 78
zeroMAx challenge 20 104
Is there a simple front-end menu system. 9 89
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question