954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need assistance...................

Hello All,

I am copying file from one machine to another machine
after that execute that file on remote computer using c#.

I am using below command to copy file
File.Copy(sourcePath, DestinationPath, true);

and

ManagementClass remote_Class = new ManagementClass ("\\machineName\root\\cimv2:Win32_Process");
object[] remoterun = { destPathwithFileName, null, null, 0 };
remote_Class.InvokeMethod("Create", remoterun);

to execute that executable on remote machine.

Now I code in which I can provide domain\username and password.
I want that process to be executed by domain user on remote machine
Or process to be executed by username and password which I've provided in code.
I don't want to use LogOnUser()

##k.k##
Newbie Poster
6 posts since Aug 2009
Reputation Points: 3
Solved Threads: 0
 

In future just boost your orignal thread instead making a duplicate with a crap name.

This will get the windows identity of the machine it is executed on but make sure you add the using System.Security.Principal library.

public void getName()
        {
             // Retrieves and stores WindosIdentity in textBox1
             textBox1.Text = WindowsIdentity.GetCurrent().Name.ToString();
        }


As for the password i coulden't find out how to do it when i did a project which required it so let me know if and how you manage it.

ChrisHunter
Posting Whiz in Training
276 posts since Feb 2011
Reputation Points: 36
Solved Threads: 28
 

########################################################################################
Thanks..for suggestion... but I didn't know how to boost up the original thread so I've created the new thread.Also I tried to delete the new thread but I didn't find the delete button.
########################################################################################

Here I don't want the windows Identity of machine on which the process is executed.
I want that process or any other things such as copying,deleting or any other task should get execute with the user name which I've provided explicitly.

For ex:

Domain :
User Name :
Password :
Machine Name :

When user clicks on execute button any task such as copy,delete or execute gets execute on user provided machine with above mentioned username and password

Thanks
##K.K##

##k.k##
Newbie Poster
6 posts since Aug 2009
Reputation Points: 3
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: