# Navigate to acllock directory
cd C:\Users\umang\Downloads\acllock
# Run comprehensive test suite (requires admin)
.\test.ps1# Create test directory
mkdir C:\TestLock
echo "test data" > C:\TestLock\test.txt
# Lock it (with force to skip prompts)
.\acllock.ps1 lock "C:\TestLock" -Force
# Check status
.\acllock.ps1 status "C:\TestLock"
# Try to access (should fail for non-admin)
Get-ChildItem C:\TestLock
# Unlock
.\acllock.ps1 unlock "C:\TestLock" -Force
# Cleanup
Remove-Item C:\TestLock -Recurse -Forcemkdir C:\TestDryRun
.\acllock.ps1 lock "C:\TestDryRun" -DryRun
# Should show what WOULD happen without actually locking
Remove-Item C:\TestDryRun -Forcemkdir C:\TestJSON
.\acllock.ps1 lock "C:\TestJSON" -Force
.\acllock.ps1 status "C:\TestJSON" -Json
.\acllock.ps1 unlock "C:\TestJSON" -Force
Remove-Item C:\TestJSON -Forcemkdir C:\TestBackup
.\acllock.ps1 backup "C:\TestBackup"
.\acllock.ps1 lock "C:\TestBackup" -Force -Note "Testing backup"
.\acllock.ps1 restore "C:\TestBackup" -Force
Remove-Item C:\TestBackup -Recurse -Force.\acllock.ps1 tui
# Navigate with keyboard
# Q to quit.\acllock.ps1 help
.\acllock.ps1 version[TEST 1] PowerShell Version Check - ✓ PASS
[TEST 2] Administrator Privileges - ✓ PASS
[TEST 3] File Structure - ✓ PASS
[TEST 4] Module Loading - ✓ PASS
[TEST 5] Help Command - ✓ PASS
[TEST 6] Version Command - ✓ PASS
[TEST 7] Functional Test - ✓ PASS
If you accidentally lock a directory and can't unlock it:
# Take ownership
takeown /f "C:\LockedPath" /r /d y
# Reset ACLs to defaults
icacls "C:\LockedPath" /reset /t-
Always use
-NoProfilewhen launching PowerShell:pwsh -NoProfile -File .\acllock.ps1 lock "C:\Path"
-
Use
-Forceflag to skip confirmation prompts in scripts -
Use
-Jsonflag when integrating with other tools
# Start PowerShell as Administrator
Start-Process pwsh -Verb RunAs- Only works on NTFS drives (not FAT32, exFAT)
- Check drive format:
Get-WmiObject Win32_LogicalDisk
- Optional Sysinternals tool for process detection
- Install:
choco install handle - Tool works fine without it
# Lock before processing
.\acllock.ps1 lock "C:\SensitiveData" -Force -Note "Automated backup"
# Do work...
Backup-Data "C:\SensitiveData"
# Unlock after
.\acllock.ps1 unlock "C:\SensitiveData" -Force$status = .\acllock.ps1 status "C:\Path" -Json | ConvertFrom-Json
if ($status.isLocked) {
Write-Host "Path is locked!"
}Quick Reference Card v1.0
Project: acllock - ACL-based Windows File Locking
Author: Umang
Date: 2026-01-27