Using MemoryMappedFile dll in Powershell Core

Good day,

hopefully somebody here already did something similar and could help me out.
I have a few Start-Process calls with RedirectStandardOutput and RedirectStandardInput
to create dumps from remote servers and import them into a local db.

These dumps are only temporary and will be deleted shortly after, and so I want to store them directly in ram to speed up the process.

I have checked out PoshInternals @adam and the functions in MemoryMappedFile.ps1, but I can’t get it working.

Somebody has an idea?

Can you let me know what happens when you use the memory mapped files? Are there errors or does it just not work?

@adam There ain’t no errors, simply using

$Tmp = New-MemoryMappedFile -Name 'Tmp' -Size 100MB
Out-MemoryMappedFile -MemoryMappedFile $Tmp -String 'Test'
Read-MemoryMappedFile -MemoryMappedFile $Tmp

works just fine. My problem is that I have no clue how to tell Start-Process to use the stream writer
in -RedirectStandardOutput, if it’s even possible to do so.


I think you would need to use the System.Diagnostics.Process class directly because Start-Process just redirects to a file.

gotta try that out