A nice, short function this one;
<# .SYNOPSIS Tests if a file is locked. #> function Test-FileLocked { param ( [string]$FilePath ) try { [IO.File]::OpenWrite($FilePath).close();return $false } catch {return $true} }
Family, Cool Stuff and Assorted Geekery; the finer things in life. Updated when I have something interesting to write :)
A nice, short function this one;
<# .SYNOPSIS Tests if a file is locked. #> function Test-FileLocked { param ( [string]$FilePath ) try { [IO.File]::OpenWrite($FilePath).close();return $false } catch {return $true} }
The Windows 10 release is just around the corner and I’m going to do a fresh install on a new hard-drive. I’ve redirected most of my working directories to network locations so most of my files should just appear ‘auto-magically’ but I’m sure there’s a few files dotted around the place that are important that I’ve just ‘temporarily’ left outside one of the redirected folders.
So what I want is some PowerShell to find all the files owned by me on my hard-drives. I can do this with a one-line PowerShell command as follows; Continue reading “PowerShell : Find all Files Owned By A User”