I have a batch file that does a robocoy from serverA to serverB and it works very well.
I have a list of server names. I'd like to load this list into a powershell array and then enumerate over this array and run the robocopy using the path.
This is my working robocopy batch file:
ROBOCOPY C:\Websites\ \\serverB\C$\Websites\ /MIR
What I'd like to do is replace "serverB" with the value from the array. I've never really used powershell before, so I don't even know where to begin besides installing powershell on the machine ;)
In theory, this is what I'd like to have (psudo-code):
$serverNames = ("serverA","serverB", "serverC")
foreach ($server in $serverNames )
{
"ROBOCOPY C:\Websites\ \\" + $server + "\C$\Websites\ /MIR"
}
I guess, the question is, how do I execute what would normally be a batch command from within powershell?
Thanks for any help!