WeTi
asked on
Pwoershell to list creationtime of gci.
Dear expert
I need help with the code below, now that I got $server.name and $server.path using the import-csv, I also need the CreationTime of the file.
I tried sevral code but it didnt work as i wanted, please help.
Thanks
I need help with the code below, now that I got $server.name and $server.path using the import-csv, I also need the CreationTime of the file.
I tried sevral code but it didnt work as i wanted, please help.
Thanks
$servers = Import-Csv -Path C:\Scripts\serverlist.csv
$result= ForEach ($server in $servers) {
$count = (Get-ChildItem -Path $server.Path -ErrorAction SilentlyContinue | (get-item $server).LastWriteTime |Measure-Object).Count
If ($count -gt 0) {
"$($count) Files in '$($server.Path)'; This is for $($server.DisplayName); The last write time is: $($lastWriteTime = (Get-Item $server).LastWriteTime)"
}
}
$result
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER