Invoke-Obliteration
1.0.0
This function deletes one or more directories recursively, including its files and sub-directories.
If one of the file system objects are open in another process it attempts to close the handles.
It was designed to be fast, so we had to use partially undocumented Windows APIs and .NET asynchronous primitives.
For this reason all logic, except the monitoring, was writt
If one of the file system objects are open in another process it attempts to close the handles.
It was designed to be fast, so we had to use partially undocumented Windows APIs and .NET asynchronous primitives.
For this reason all logic, except the monitoring, was writt
This function deletes one or more directories recursively, including its files and sub-directories.
If one of the file system objects are open in another process it attempts to close the handles.
It was designed to be fast, so we had to use partially undocumented Windows APIs and .NET asynchronous primitives.
For this reason all logic, except the monitoring, was written in C#. That's why the huge signature.
The closing handle mechanism was ported from the 'WindowsUtils' module.
ATTENTION!!!
This function deletes files and potentially closes open handles without prompting for confirmation!
It was designed to be like that, simple, fast, and deadly.
Closing other processe's handles to a file system object may cause system malfunction. Use it with care!
About privileges:
This function requires to be ran as administrator, because it needs access to delete files potentially in protected places.
The main API enables the 'SeBackupPrivilege' and 'SeRestorePrivilege' for the executing process token during execution to make sure we have the right permissions.
These privileges are disabled once the method ends.
About cancellation:
The main API implements a cancellation handler to capture 'Ctrl-C' and 'Ctrl-Break' commands.
All the internal APIs were designed with cooperative multitasking in mind, so if you press a cancellation combination the operation stops.
Due some bugs I found with Windows PowerShell I couldn't remove the handler at the end of execution because it breaks the console.
Although the handle continues registered it does nothing if it's not in the method execution 'context'.
Show more
If one of the file system objects are open in another process it attempts to close the handles.
It was designed to be fast, so we had to use partially undocumented Windows APIs and .NET asynchronous primitives.
For this reason all logic, except the monitoring, was written in C#. That's why the huge signature.
The closing handle mechanism was ported from the 'WindowsUtils' module.
ATTENTION!!!
This function deletes files and potentially closes open handles without prompting for confirmation!
It was designed to be like that, simple, fast, and deadly.
Closing other processe's handles to a file system object may cause system malfunction. Use it with care!
About privileges:
This function requires to be ran as administrator, because it needs access to delete files potentially in protected places.
The main API enables the 'SeBackupPrivilege' and 'SeRestorePrivilege' for the executing process token during execution to make sure we have the right permissions.
These privileges are disabled once the method ends.
About cancellation:
The main API implements a cancellation handler to capture 'Ctrl-C' and 'Ctrl-Break' commands.
All the internal APIs were designed with cooperative multitasking in mind, so if you press a cancellation combination the operation stops.
Due some bugs I found with Windows PowerShell I couldn't remove the handler at the end of execution because it breaks the console.
Although the handle continues registered it does nothing if it's not in the method execution 'context'.
Installation Options
Owners
Package Details
Author(s)
- francisconabas@outlook.com
Tags
Remove Delete Files Folders PowerShell Microsoft Windows Explorer
Dependencies
This script has no dependencies.
FileList
- Invoke-Obliteration.nuspec
- Invoke-Obliteration.ps1
Version History
Version | Downloads | Last updated |
---|---|---|
1.0.2 | 14 | 10/28/2024 |
1.0.1 | 134 | 10/12/2024 |
1.0.0 (current version) | 6 | 10/11/2024 |