I have the following script to list big files on list of servers. Unfortunately it is not listing anything. However, if I replace the $_.Name by the string D:\ it works fine.
$servers = Get-Content "servers1.txt" | Select-String -pattern `
"^[^#]"
foreach ($line in $servers) {
$svr = echo $line | %{$_.Line.split(':')[2]}
Get-WmiObject Win32_Volume -ComputerName $svr -ErrorAction SilentlyContinue |
Select-Object __SERVER,Name |
foreach {
Invoke-command {Get-ChildItem -path $_.Name -rec | Where-Object `
-FilterScript {($_.Length -ge 3GB) -and ($_.Name -notlike "*.mdf")}} -computername $svr
}
}
Thanks for any help.