Reputation: 183
I want to get a list of files in a specific location from a list of remote computers. I want the output to have the File Name, Last Write Time and the Computer's Name that it's from.
The properties of the files don't include a computer name. So how could I build the file list including the computername in the output?
$serverlist = Get-Content c:\jasonbe\Serverlist.txt
foreach ($server in $serverlist)
{Get-ChildItem '\\server\c$\location\Ultimate\Retail\Bin\' | Select Name, LastWriteTime, Length
Get-ChildItem '\\server\c$\location\Ultimate\Retail\Reports\*.rpt' | Select Name, LastWriteTime, Length
}
Hope I make sense :)
Upvotes: 0
Views: 141
Reputation: 60910
try changing the select like this:
Select Name, LastWriteTime, Length, {$server}
Upvotes: 1