I try to retrieve the logs from remote computers and copy them to my local drive, when i try to do this with one computer it works but not for a group of Workstations. something is wrong with my for loop , i don't know yet if i can add a test ping before trying to do the copy
the code is below :
$computerName = Get-Content "d:\Workstations_list.txt"
$destination = New-Item -ItemType Directory -Path C:\Temp\$computerName -Force
$source = "C$\Windows\minidump"
foreach ($computer in $computername)
{
$remoteFile = "\\$computerName\$source"
Write-Verbose "Copy $remoteFile to $destination"
Copy-Item $remoteFile -Destination $destination
}