PowerShell “Exception of type ‘System.OutOfMemoryException'”

In middle of a script execution, Got the below error: The following exception was thrown when trying to enumerate the collection: “Exception of type ‘System.OutOfMemoryException’ was thrown.”. At d:\Scripts\VersionRpt.ps1:19 char:16 +         foreach <<<<  ($FileVersion in $File.Versions)     + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException     + FullyQualifiedErrorId : ExceptionInGetEnumerator Solution: Increase the…

Read more