Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#One liner answer to 'Beginner Task'
#relies on the fact that all Latin-1 accented characters have an ASCII value > 192 (https://msdn.microsoft.com/en-us/library/ms537495(v=vs.85).aspx)
#Not clear from brief on how this is meant to be run, but works locally:
Get-ChildItem c:\temp\FileShare -recurse | Where-Object{[int[]][char[]]$_.name -gt 192} | Format-Table name, @{label="Directory"; Expression={$_.DirectoryName}}, @{label="Creation Date"; Expression={$_.CreationTime}},@{label="Last Modification Date"; Expression={$_.LastWriteTime}}, @{label="File Size"; Expression={$_.length}}
#Over UNC
Get-ChildItem \\labbox1\share$\FileShare -recurse | Where-Object{[int[]][char[]]$_.name -gt 192} | Format-Table name, @{label="Directory"; Expression={$_.DirectoryName}}, @{label="Creation Date"; Expression={$_.CreationTime}},@{label="Last Modification Date"; Expression={$_.LastWriteTime}}, @{label="File Size"; Expression={$_.length}}
#Or via RemotePS:
Invoke-Command -Computer labbox1 -Scriptblock {Get-ChildItem c:\temp\FileShare -recurse | Where-Object{[int[]][char[]]$_.name -gt 192} | Format-Table name, @{label="Directory"; Expression={$_.DirectoryName}}, @{label="Creation Date"; Expression={$_.CreationTime}},@{label="Last Modification Date"; Expression={$_.LastWriteTime}}, @{label="File Size"; Expression={$_.length}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment