I am trying to write an application that copies and installer I created over to a list of computers provided. It works perfect with only one computer name in the input but when I add two or more it tells me it cannot read from the source file because its in use.
UPDATE: I am open to other methods of getting this done if this is just a lost cause. My end goal is to simply copy the same file to 500 computers in a datacenter as fast as possible. Then execute the file on each of those computers. Right now for the execution I am using psexec -s so I can bypass UAC.
/*Button Click Code Below*/
/*Install for specific OS*/
foreach (string line in txtServers.Lines)
{
machine = line;
lbOutput.Items.Add("Preparing to copy files....");
/*Copy Files*/
if(!tWorker.IsAlive)
tWorker.Start();
lbOutput.Items.Add("File Copy Complete! Executing installer....");
}
/*File Copy Code Below*/
try
{
File.Copy("Ionic.Zip.Reduced.dll",@"\\"+machine+@"\C$\Temp\Ionic.Zip.Reduced.dll",true);
File.Copy("v5.32bit.Install.exe", @"\\" + machine + @"\C$\Temp\v5.32bit.Install.exe", true);
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}