Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7824411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:35:15+00:00 2026-06-02T08:35:15+00:00

I try to access a virtual disk service (VDS) on a remote machine. After

  • 0

I try to access a virtual disk service (VDS) on a remote machine. After solving some issues that were related to missing Windows Firewall rules (RPC not available) I`m running into an UnauthorizedAccessException (E_ACCESSDENIED) when querying the service.

This is my code:

        // Create the service loader
        VdsServiceLoader loaderClass = new VdsServiceLoader();
        IVdsServiceLoader loader = (IVdsServiceLoader)loaderClass;            
        Console.WriteLine("Got Loader");

        // Load the vds service
        try
        {
            loader.LoadService(<Hostname>, out service);
        }
        catch (UnauthorizedAccessException)
        {
            // E_ACCESSDENIED
            Console.WriteLine("Need admin rights");
            return;
        }

If I access the local service this Exception is thrown when I didn’t execute with admin rights. If I excecute with admin rights, everything is fine and I get the local VDS information without problems.

I think I`ve to specify a Username/Password somewhere to access the service, but I don’t know where. Or grant access rights to this service on the remote machine.

I also tried the suggested ImpersonateUser like this

if (ImpersonationAPI.LogonUser(pUsername, pDomain, pPassword, LogonType.LOGON32_LOGON_NEW_CREDENTIALS, LogonProvider.LOGON32_PROVIDER_WINNT50, ref token) != 0)
{
    if (ImpersonationAPI.DuplicateToken(token, SecurityImpersonationLevel.SecurityImpersonation, ref tokenDuplicate) != 0)
    {
         tempWindowsIdentity = new WindowsIdentity(tokenDuplicate);
         LoadUserProfile(tokenDuplicate, pUsername);
         m_ImpersonationContext = tempWindowsIdentity.Impersonate();
         ...
     }
}

I also tried the flags LOGON32_LOGON_INTERACTIVE, LOGON32_LOGON_NETWORK, LOGON32_LOGON_NETWORK_CLEARTEXT and LOGON32_LOGON_SERVICE.

Both machines running Win 7.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:35:17+00:00Added an answer on June 2, 2026 at 8:35 am

    You need to log on to the remote machine and impersonate a user with appropriate rights there. For this, use LogonUser with LOGON32_LOGON_NEW_CREDENTIALS logon type, construct a Windows identity with the resulting token and impersonate it. See e.g. this question Get impersonated user name for a sample.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Any ideas why on some links that I try to access using HttpWebRequest I
I need to create a virtual file, a file that if some program access
When I try to access info that is not presented in xml like so:
I am having an issue where I try to access the Lists.asmx web service
I have a scenario that when I try to access a hash key using
I'm installing apache in a Windows virtual machine and I can access it with
I try to access the MainContentBlock control from the aspx, but unable to do
When you try to access a key which isn't in a Dictionary (for example),
My app crash when I try to access any property of my NSDecimalNumber amount_before_current_year:
The error message I gen when I try to access the web page server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.