CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2000
    Location
    New Jersey
    Posts
    968

    Remote Execute (RPC) failing Win32_Process with E_ACCESSDENIED

    I'm trying to execute a command on a remote machine using WMI, and it's failing in the following line of code:
    hRes = pService->GetObject(_bstr_t(L"Win32_Process"), NULL, NULL, &pProcess, NULL);
    if(FAILED(hRes))
    {
    return E_FAIL; // Fails here
    }

    For full code, see following links:
    code.axter.com/cprocess.h
    code.axter.com/cprocess.cpp

    Does anyone know why I would get this failure, and how to fix it?
    Last edited by Axter; May 29th, 2007 at 05:13 AM.
    David Maisonave
    Author of Policy Based Synchronized Smart Pointer
    http://axter.com/smartptr


    Top ten member of C++ Expert Exchange.
    C++ Topic Area

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Remote Execute (RPC) failing Win32_Process with E_ACCESSDENIED

    You should examine the returned value hRes for valuable information.

    Take a look at the _com_error class.

    - petter

  3. #3
    Join Date
    Aug 2000
    Location
    New Jersey
    Posts
    968

    Re: Remote Execute (RPC) failing Win32_Process with E_ACCESSDENIED

    I forgot to include this in the body of the question, but if you look at the question title, you'll notice I stated that it's returning E_ACCESSDENIED
    David Maisonave
    Author of Policy Based Synchronized Smart Pointer
    http://axter.com/smartptr


    Top ten member of C++ Expert Exchange.
    C++ Topic Area

  4. #4
    Join Date
    Jul 2005
    Location
    E: 120°.6, N: 31°.3′
    Posts
    795

    Re: Remote Execute (RPC) failing Win32_Process with E_ACCESSDENIED

    For full code, see following links:
    code.axter.com/cprocess.h
    code.axter.com/cprocess.cpp
    I can not open this link, but it something like This
    Little by little one goes far
    Keep moving.......!
    Nothing is impossible !

  5. #5
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Remote Execute (RPC) failing Win32_Process with E_ACCESSDENIED

    Quote Originally Posted by Axter
    I forgot to include this in the body of the question, but if you look at the question title, you'll notice I stated that it's returning E_ACCESSDENIED
    Sorry. I read the title but somehow that didn't get through. Time to log off.

    - petter

  6. #6
    Join Date
    Jul 2005
    Location
    E: 120°.6, N: 31°.3′
    Posts
    795

    Re: Remote Execute (RPC) failing Win32_Process with E_ACCESSDENIED

    and what's your development environment ?? Microsoft Visual Studio Extensions or others??
    Little by little one goes far
    Keep moving.......!
    Nothing is impossible !

  7. #7
    Join Date
    Aug 2000
    Location
    New Jersey
    Posts
    968

    Re: Remote Execute (RPC) failing Win32_Process with E_ACCESSDENIED

    I can not open this link, but it something like This

    Yes.
    Now I know the true source of this code. I got it from another web site, but I guess they got it from here.

    Did you try putting http in front of it?
    http://code.axter.com/cprocess.h

    http:// code.axter.com/cprocess.cpp
    Last edited by Axter; May 29th, 2007 at 05:20 AM.
    David Maisonave
    Author of Policy Based Synchronized Smart Pointer
    http://axter.com/smartptr


    Top ten member of C++ Expert Exchange.
    C++ Topic Area

  8. #8
    Join Date
    Aug 2000
    Location
    New Jersey
    Posts
    968

    Re: Remote Execute (RPC) failing Win32_Process with E_ACCESSDENIED

    and what's your development environment ?? Microsoft Visual Studio Extensions or others??
    I'm using VC++ 8.0 (2005)
    The project is compiled as a regular console application.
    David Maisonave
    Author of Policy Based Synchronized Smart Pointer
    http://axter.com/smartptr


    Top ten member of C++ Expert Exchange.
    C++ Topic Area

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured