‘InitiateSystemShutdownEx’ returns Access Denied 5 RRS feed

  • Question

  • Hello,

    we are using the ‘InitiateSystemShutdownEx’ method to shutodwn the system. The  code used to work fine windows 2003 server and now this is not working in Windows 2008R2 server.

    Before calling this method we are doing all the stuff that need to be done with respect to the Privileges.

    Logging in to Board with Account: Administrator Domain
    AdminToken::LogonUser Successful
    AdminToken::ImpersonateLoggedOnUser Successful
    AdminToken::LookupPrivilegeValue Successful
    AdminToken::AdjustTokenPrivileges Successful

    And at the end, when we call the ‘InitiateSystemShutdownEx’ it returns access denied. which logged in the event log. Snippet of the event log.

    The description for Event ID 2 from source <Service Name> cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
    If the event originated on another computer, the display information had to
    be saved with the event.
    The following information was included with the event:
    ******** MAJOR    LocalHost::<Service Name>  ********
    47.9 EM_UnexpectedFailure     : processinfo.cpp(1786): unexpected failure of
    114.30 PM_InitiateSystemShutdownExFailed: Fail to reboot OS of
    '<computer name>' with error : 'Access is denied. (5)'



    Monday, April 16, 2012 7:41 AM