Last active
March 10, 2016 10:41
-
-
Save Stuart-Moore/a5147932905384e4c0e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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