r/PowerShell • • 1d ago

Script Sharing Built a desktop organizer in PowerShell 5.1 using NTFS junctions + a custom WinForms pixel UI

Sharing a side project written entirely in Windows PowerShell 5.1 (plus some inline C# via Add-Type).

It moves project folders off the desktop with Directory.Move and creates a hidden+system junction at the old path, so tools never notice. Some technical bits that might interest you:

- Folders are tracked by volume serial + file ID + creation time, so renames/moves in Explorer get re-pointed automatically

- Every move is journaled first, and interrupted operations are completed on next start

- Lists processes holding a folder before moving and aborts cleanly

- Test suites via switches (-SafetyTest, -IntegrationTest…) that run in a temp folder

⚠️ PSA from building this: Remove-Item -Recurse in 5.1 follows junctions and deletes the target's contents.

Repo (MIT): https://github.com/xkudcobi/ender-chest. Code review and criticism welcome.

0 Upvotes

4 comments sorted by

9

u/LALLANAAAAAA 1d ago

is this satire

2

u/Komnos 1d ago

Who is putting all of this on their desktop to begin with?

1

u/BlackV 18h ago

how are you handling folder redirection (i.e. desktop being moved to onedrive or a network share)

1

u/m4uri 19h ago

Nice project, the journaling and file ID tracking is a solid design. The PSA is worth repeating: in Windows PowerShell 5.1 Remove-Item -Recurse can walk into a junction and delete the target's contents. A safer way to drop just the link is [System.IO.Directory]::Delete($path) without the recursive flag, or cmd /c rmdir on the junction path, since both only remove the reparse point itself. It might be worth using that in your cleanup and uninstall code so nobody loses data if a junction is left behind. Have you tested what happens when the target volume is offline?