Skip to content

Latest commit

 

History

History
167 lines (126 loc) · 3.29 KB

File metadata and controls

167 lines (126 loc) · 3.29 KB

acllock - Quick Test Guide

Run Test Suite

# Navigate to acllock directory
cd C:\Users\umang\Downloads\acllock

# Run comprehensive test suite (requires admin)
.\test.ps1

Manual Testing Commands

1. Basic Lock/Unlock Test

# 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 -Force

2. Test Dry Run Mode

mkdir C:\TestDryRun
.\acllock.ps1 lock "C:\TestDryRun" -DryRun
# Should show what WOULD happen without actually locking
Remove-Item C:\TestDryRun -Force

3. Test JSON Output

mkdir C:\TestJSON
.\acllock.ps1 lock "C:\TestJSON" -Force
.\acllock.ps1 status "C:\TestJSON" -Json
.\acllock.ps1 unlock "C:\TestJSON" -Force
Remove-Item C:\TestJSON -Force

4. Test Backup/Restore

mkdir 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

5. Test TUI Mode

.\acllock.ps1 tui
# Navigate with keyboard
# Q to quit

6. Test Help and Version

.\acllock.ps1 help
.\acllock.ps1 version

Expected Test Results

✅ All Tests Should Pass

[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

Emergency Recovery

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

Performance Tips

  1. Always use -NoProfile when launching PowerShell:

    pwsh -NoProfile -File .\acllock.ps1 lock "C:\Path"
  2. Use -Force flag to skip confirmation prompts in scripts

  3. Use -Json flag when integrating with other tools


Common Issues

"Not recognized as Administrator"

# Start PowerShell as Administrator
Start-Process pwsh -Verb RunAs

"Path must be on NTFS volume"

  • Only works on NTFS drives (not FAT32, exFAT)
  • Check drive format: Get-WmiObject Win32_LogicalDisk

"handle.exe not found" (warning only)

  • Optional Sysinternals tool for process detection
  • Install: choco install handle
  • Tool works fine without it

Integration Examples

Script Integration

# 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

JSON Parsing

$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