# Simulate error by creating file in current directory with some contents; then, open file in locking mode
Add-Content ($directories+”\testlock.txt”) “cowabunga!”
$file=[System.IO.File]::Open(($directories+”\testlock.txt”), ‘Open’, ‘Read’, ‘None’)
 
# Close file afterward
$file.close();