How can I export LastWriteTime data for files to Excel without running into access errors?

0
5
Asked By CuriousCoder92 On

I'm trying to create a spreadsheet that lists the LastWriteTime for hundreds of files and export this data to Excel. However, every time I try using the Export-Csv command, I encounter an error indicating that there's an unauthorized access issue. I suspect this is related to file permissions since LastWriteTime seems to be working fine. Interestingly, I've encountered similar issues on my personal PC as well. I'm using Windows 10 Pro x64 version 22H2.

1 Answer

Answered By TechSavvy123 On

Could you share the code you’re using? Also, make sure you're running PowerShell with Administrator privileges. Are you querying the directory recursively for 'C:Users'? That might be causing the issue.

CuriousCoder92 -

Sure! Here's my basic code: Get-ChildItem -Path "\fs2userdatatolstikov_asDesktopTransmital" | Select Name, LastWriteTime | Export-Csv -Path "D:". When I try exporting to the same folder, I still get the same error regarding user privileges.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.