Hello Guys,
I would like to know wheter are there any (efficent) solution to download big files (e.g. ~GB) from remote computer using PowerShell?
I found severel file uploader PS scripts, but in this case this is not the good way for me.
I didn't find the correct PS method. I used the Invoke-Method to recive the chunked content from remote computer, but it was really slow. (e.g. receive a chunk (0.01 MB) ~2 sec on my local computer)
Construction:
1.)Open the remote session and the file stream
2.)Get Chunked file pieces based on chunkSize
3.)Close the remote file stream in the session
Here is my sample:
$chunksize = 0.01MB $piece = Invoke-Command -session $Session -scriptblock { param($sizeofchunk) try { [byte[]]$contentchunk = New-Object byte[] $sizeofchunk $filestream.Read($contentchunk, 0, $sizeofchunk ) return $contentchunk } catch { write-error "could't read file:" $_.exception.tostring() return 0 } } -argumentlist $chunksize
Thank you for your help,
Viktor