Skip to content

Instantly share code, notes, and snippets.

@Stuart-Moore
Last active March 10, 2016 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stuart-Moore/a5147932905384e4c0e8 to your computer and use it in GitHub Desktop.
Save Stuart-Moore/a5147932905384e4c0e8 to your computer and use it in GitHub Desktop.
#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