Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Last Folder or doc accessed on the server share

Last Folder or doc accessed on the server share

Last Folder or doc accessed on the server share

Good Day

I need help with extracting information regarding server share on which I need to few the last accessed folder and doc. I have a script written in PowerShell the problem is I cannot get the output

Get-ChildItem -Recurse "C:\Users\ProfileUser\Desktop\Users.ps1" | ?{ $_.PSIsContainer } | Select-Object FullName,lastwritetime | Out-File 'C:\Users\ProfileUser\Desktop\Test.log'

I'm not sure what's wrong. Thank u

RE: Last Folder or doc accessed on the server share

CODE --> YourCode

Get-ChildItem -Recurse "C:\Users\ProfileUser\Desktop\Users.ps1" | ?{ $_.PSIsContainer } | Select-Object FullName,lastwritetime | Out-File 'C:\Users\ProfileUser\Desktop\Test.log' 

You are using a file "Users.ps1" as the start of your search, yet filtering for directories. That doesn't work.

Try this to see if you get anything:

CODE -->

Get-ChildItem -Recurse "C:\Users\ProfileUser" | Select-Object FullName,LastWriteTime | Out-File 'C:\Users\ProfileUser\Desktop\Test.log' 

You could go one step further and sort it by the LastWriteTime:


$search = Get-ChildItem -Recurse "C:\Users\ProfileUser" | Select-Object FullName,LastWriteTime
$search = $search | sort LastWriteTime -Descending
$search | Out-File 'C:\Users\ProfileUser\Desktop\Test.log' 

Light travels faster than sound. That's why some people appear bright until you hear them speak.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close