How to Manage Open File Handles with PowerShell

Julia Tim/ShutterstockOne of the more frustrating errors that an end-user or IT administrator can deal with is that of locked files within Windows. When you delete a folder, move a file, or edit a configuration and you encounter a locked file error message, it’s better to deal with that quickly and efficiently. Microsoft introduced PowerShell as a replacement shell, but it has far more functionality than that and is a complex and capable language. Let’s look in this article on how you can utilize PowerShell to deal with locked files. The Locked File Problem How exactly does a file get locked? During normal use, a process creates many handles to resources such as a file. By doing so, the processes often lock the file to prevent unintended configuration changes or other corruption from taking place. The problem often is that it is difficult to determine what process has locked the file, and subsequently, how to remove that lock from the file. Unfortunately, there is no built-in cmdlet to test a file and tell whether it is locked or by what process. Therefor… Click below to read the full story from How To Geek
Read More