How can I use Handle.exe with PowerShell

Nobody is helping and I can’t solve this problem. I want to remove any that has a handle on Notepad.exe. I know how to run sysinternal handle.exe in this url source. But I am coding a software and I want to execute an automatic code with powershell and do it with a single code. https://docs.microsoft.com/tr-tr/sysinternals/downloads/handle

How can I close a handle I want with Windows Sysinternals Handle v4.22?

Example: Notepad.exe > Handles > C:\Users\dream > Close > Happy end

I want to close all C:\Users\dream handles open on Notepad.exe.

But I want to do this using the handle.exe via powershell. How can I do this with a single code? Please help. :frowning:

https://devblogs.microsoft.com/scripting/use-powershell-to-explore-process-threads-in-windows/
https://www.powershellgallery.com/packages/PoshInternals/1.0.31/Content/Handle.ps1

A quick internet search for PowerShell and Handle returned this. Might give you some direction.

PowerShell Gallery | Handle.ps1 1.0.31