I'm trying to compress IIS Log files (60GB total) using Compress-Archive
, however I get the error:
"Exception of type 'System.OutOfMemoryException' was thrown."
$exclude = Get-ChildItem -Path . | Sort-Object -Descending | Select-Object -First 1
$ArchiveContents = Get-ChildItem -Path . -Exclude $exclude | Sort-Object -Descending
Compress-Archive -Path $ArchiveContents -DestinationPath .\W3SVC2.zip -Force
I've already adjusted MaxMemoryPerShellMB
to 2048MB
and restarted the WinRM service.
RAM Memory consumption exceeds 6GB when the command is executed.