What about "pwsh -nop -ep bypass -f C:\temp\test.ps1"
Results:
PowerShell 7.6.4
PS C:\Program Files\PowerShell-7.6.4-win-x64> pwsh -nop -ep bypass -f C:\temp\test.ps1
Directory: C:\Users\theislands\AppData\Local\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- Thursday, July 30, 2026 41723480 2D0890CA-2A98-4054-9218-BE7C13306EB2.exe
9:06 PM
-a--- Friday, July 31, 2026 41728248 4FAB5FCE-5E9F-4B99-8D00-5F41F939C928.exe
9:29 PM
-a--- Wednesday, July 29, 2026 331776 7z.exe
3:25 PM
-a--- Friday, February 25, 2022 304128 offlinereg-win32.exe
6:52 PM
----- Thursday, January 29, 112654 wimlib-imagex.exe
2026 6:48 PM
-a--- Wednesday, July 29, 2026 1167872 7z.dll
3:25 PM
----- Thursday, January 29, 497678 libwim-15.dll
2026 6:48 PM
-a--- Monday, February 8, 2010 56200 offreg.dll
8:59 PM
Outside loop: D
Inside loop: D:
Get-ChildItem: C:\temp\test.ps1:216
Line |
216 | dir $EFI_BootMgr_File
| ~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'D:\EFI\Microsoft\Boot\bootmgfw.efi' because it does not exist.
Directory: D:\EFI\Boot
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- Monday, August 3, 2026 3086728 bootx64.efi
10:03 PM
Directory: D:\sources
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- Monday, August 3, 2026 800436956 boot.wim
10:04 PM
USB Drive D: "HASLEOBS"
Index: 1
PS C:\Program Files\PowerShell-7.6.4-win-x64>