Hi guys, thanks for your help. At last I already solve my problem.. :) Here's the new and working codes.
<br />
Public Class Form6<br />
<br />
<runtime.interopservices.dllimport("advapi32.dll",> _<br />
Public Shared Function LogonUser(ByVal lpszUsername As String, ByVal lpszDomain As String, _<br />
ByVal lpszPassword As String, ByVal dwLogonType As Integer, ByVal dwLogonProvider As Integer, _<br />
ByRef phToken As IntPtr) As Integer<br />
End Function<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim sToken As IntPtr<br />
Dim impersonatedUser As Principal.WindowsImpersonationContext = Nothing<br />
Dim wid_current As WindowsIdentity = WindowsIdentity.GetCurrent()<br />
Dim wid_admin As WindowsIdentity = Nothing<br />
Dim wic As WindowsImpersonationContext = Nothing<br />
Try<br />
MessageBox.Show("Copying file...")<br />
' ''-------If LogonUser("Username", "computer name of 192.168.10.03", "passwordd", 9, 0, sToken) <> 0 Then ---------'' '<br />
<br />
If LogonUser("AB208145", "PROD-PC", "208145", 9, 0, sToken) <> 0 Then<br />
wid_admin = New WindowsIdentity(sToken)<br />
wic = wid_admin.Impersonate()<br />
' ''-------("\\IP add\shared folder\file to be copy),(my drive c:\copy file)------------'' '<br />
System.IO.File.Copy("\\192.168.10.03\sample01\HRIS.exe", "C:\HRIS.exe", True)<br />
<br />
MessageBox.Show("Copy succeeded")<br />
Else<br />
MessageBox.Show("Copy Failed")<br />
<br />
End If<br />
Catch se As System.Exception<br />
Dim ret As Integer = Marshal.GetLastWin32Error()<br />
MessageBox.Show(ret.ToString(), "Error code: " + ret.ToString())<br />
MessageBox.Show(se.Message)<br />
Finally<br />
If wic IsNot Nothing Then<br />
wic.Undo()<br />
End If<br />
End Try<br />
End Sub<br />
End Class<br />