Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Correct me if I'm wrong, but you can use <a href="http://msdn.microsoft.com/en-us/library/aa378184.aspx" rel="noreferrer">LogonUser</a> to impersonate a local group also not only domain accounts.</p> <p><a href="http://social.msdn.microsoft.com/forums/en-US/vblanguage/thread/b9906632-5cad-4972-9103-3e864a71a0c2/" rel="noreferrer">From the net:</a></p> <pre><code>Imports System Imports System.Runtime.InteropServices Imports System.Security.Principal Imports System.Security.Permissions Public Class Form1 &lt;DllImport("advapi32.DLL", SetLastError:=True)&gt; _ 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) &lt;&gt; 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 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload