I created a .ps1 script which run remotely a .exe file on multiple servers. That .exe file create an output.xml. Now I want to change that name of it, which is the same for each server with a random name or if it is possible with the name of the server where that .exe is running. Below you can see my code:
foreach ($computers in ($computers = Get-Content 'C:\test\comp.txt'))
{
$server ={& 'C:\Program Files (x86)\myexe.exe' --outputfile='C:\test.xml'}
Invoke-Command -ScriptBlock $server -ComputerName $computers
}
Myexe.exe file run on each computer defined in $computers variable. Exist the possibility to change the name of test.xml o each server ?