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 183981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:12:42+00:00 2026-05-11T15:12:42+00:00

I am using C#… I need the ability to copy a set of files

  • 0

I am using C#…

I need the ability to copy a set of files to about 500 unique computers. I have successfully been able to use the LogonUser() method to impersonate a domain account that has the required permissions to copy the files. The destination path for the files is something like:

\\RemoteComputer\C$\SomeFolder

My questions is…is there a way to do this without having to use an all-powerful domain account (these computers may not be joined to the domain in the future)? I have the local administrator accounts for every computer…is there a simple way to copy a file to a computer using it’s LOCAL administrator account rather than a domain account?

  • 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. 2026-05-11T15:12:43+00:00Added an answer on May 11, 2026 at 3:12 pm

    Correct me if I’m wrong, but you can use LogonUser to impersonate a local group also not only domain accounts.

    From the net:

    Imports System  Imports System.Runtime.InteropServices  Imports System.Security.Principal  Imports System.Security.Permissions  Public Class Form1      <DllImport('advapi32.DLL', SetLastError:=True)> _      Public Shared Function LogonUser(ByVal lpszUsername As String, ByVal lpszDomain As String, _          ByVal lpszPassword As String, ByVal dwLogonType As Integer, ByVal dwLogonProvider As Integer, _          ByRef phToken As IntPtr) As Integer      End Function      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click          Dim admin_token As IntPtr          Dim wid_current As WindowsIdentity = WindowsIdentity.GetCurrent()          Dim wid_admin As WindowsIdentity = Nothing          Dim wic As WindowsImpersonationContext = Nothing          Try              MessageBox.Show('Copying file...')              If LogonUser('Local Admin name', 'Local computer name', 'pwd', 9, 0, admin_token) <> 0 Then                  wid_admin = New WindowsIdentity(admin_token)                  wic = wid_admin.Impersonate()                  System.IO.File.Copy('C:\right.bmp', '\\157.60.113.28\testnew\right.bmp', True)                  MessageBox.Show('Copy succeeded')              Else                  MessageBox.Show('Copy Failed')              End If          Catch se As System.Exception              Dim ret As Integer = Marshal.GetLastWin32Error()              MessageBox.Show(ret.ToString(), 'Error code: ' + ret.ToString())              MessageBox.Show(se.Message)          Finally              If wic IsNot Nothing Then                  wic.Undo()              End If          End Try      End Sub  End Class  
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using VB.Net2010 I need to call a C# DLL The problem I have is
Using Jackson, how can I have JSON serialized/deserialized by one application using one set
Using Nunit, I want to be able to write a test fixture that will
Using a restful resource in Rails, I would like to be able to insert
Using C# for ASP.NET and MOSS development, we often have to embed JavaScript into
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using MVC2 I have an AJAX form which is posting to a bound model.
using a binary search tree I need to add to a vector all int
Using Core Data, I have a fetch request to fetch the minimum of a
(Using MVC 2) From inside my controller action, I need to display the url:

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.