Avatar of knamc99
knamc99

asked on 

Powershell script "Out of Shared Memory" error

I am running this powershell script from my PC and it keeps running out of shared memory and locking up my computer.  I am hoping that there may be a better way.  This script pulls the last line of my files that contain the row counts.  Some of these files have millions of rows.

This is my first powershell script and are very new to it.

cd "O:\Private\WLP_SSIS\Files\Load\Visit_In"

$files = Get-ChildItem "O:\Private\WLP_SSIS\Files\Load\Visit_In\"*.txt

foreach ($file in $files)
{
    (Get-Content $file )[-1] | Out-File c:\test\Visit_In_Counts.txt -Append
}
PowershellScripting LanguagesProgramming

Avatar of undefined
Last Comment
knamc99

8/22/2022 - Mon