PowerShell Troubleshooting Tricks: Array dimensions exceeded supported range

This morning there was a support call for a well known issue in PowerShell.

"Array dimensions exceeded supported range."

This occurs because of an Out of Memory Exception.

This is very well explained by Ed Wilson in his book. Read it a while back but not sure which piece of code was causing this error because we didn't see the code.

However, this is how you should know the array value supported in your PowerShell Versions.

[int]::MaxValue

[int]::MaxValue

Result:

2147483647

Okay, this proved if anything beyond this value will give "Array dimension exceeded supported range".

Check your max value of array and Enjoy PowerShell :)