Hi Luc.
I did found a code from which I can get the last write time of user profile folder from C drive and this is what I need to know who used the VMs last time. But I cant get the details for multiple VMs. if I put the multiple VMs its give the error (screen shot attached). but when I put only single name in the txt file it ran successfully. Also In the output I am not getting the VMs name (Screen shot attached). Is there any way you can help with this pls.
$LastLogin = $login
$computer = Get-Content -path "F:\Last_Login\VM.txt"
$Login = Get-ChildItem "\\$computer\c$\Users" | Sort-Object LastWriteTime -Descending | Select-Object Name, LastWriteTime -first 1
$LastLogin | Export-CSV "F:\\Last_Login\Lastlogins.csv" -NoTypeInformation -Encoding UTF8
Output - VMs name not there in Output file..

Error when I put multiple Name in VM.txt file
