简体   繁体   中英

How to transfer files to a Virtual Machine on the same network programmatically?

This is the situation that I have :

I have a system from which I need to transfer few files(exe files) to a virtual machine. This process has to be done for a large number of VM's that will be spawned by some tool.

I know the IP address of the VM and I have the credentials of the virtual machine. How do I go about sending the files from my system(the server) to the VM. Once I send the files to the virtual machine, it need to execute the files on the VM(exe files).

I've looked into impersonation in C#. From what I've found it just enables you to impersonate another user, not transfer files( correct me if I'm wrong). If it is possible using impersonation, how would I go about doing this?

Another option that seems feasible is using a SMB (Server Message Block), but support for this is C# seems very poor.

How would I go about sending these files to the VM ?

Note:

The VM's will have either Windows 7 or Windows 8.

The server is Windows Server 2008

This can be done using impersonation in C#. Once you have impersonated the users credentials, you can use normal file copying methods to transfer the files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM