Trying to create a script that will:
1) look at the list of computers in my file
2) Remote to that computer and fild the last write date of that file
Here's what I have, of course it's not working yet -
$results = @()
$Computers = Get-Content 'C:\Users\myusername\Desktop\script\list.txt'
$files = get-content ''
Foreach ($Computer in $Computers)
{
set-location "\\$computer\c$\folder\install"
$filecol = (Get-Item FILE_backup.pl).LastWriteTime |
foreach ($file in $filecol)
{
$results +=New-Object psObject
-Property @{'Computer'=$computer;'FileName'=$file;'LastWriteTime'=$file.lastwritetime}
}
}
Export-Csv test.csv -NoTypeInformation