Collaboration-2-Go


Lösungen und Software-Entwicklung im Collaboration Umfeld, insbesondere Microsoft SharePoint, Microsoft Exchange und Microsoft Office.

Support


Mobil: +49 (152) 53 97 78 79
Mail: service@collaboration-2-go.de
Weitere Kontaktmöglichkeiten: Kontaktseite
Dekoration: Köln



Check if File is Locked
Created: 20.09.2017
Categories: PowerShell

      If you want to check if a file is locked you can you this snippet:

      
      $locked = $true
      while ($locked)
      {
          try
          {
              $file = New-Object System.IO.FileInfo $Path
              [IO.File]::OpenWrite($file).close();
              $locked = $false
          }
          catch
          {
              # file is locked by a process.
              Start-Sleep -s 1000
          }
      }
      

    

Send us a Comment!