to see the snaps add - write-output $NetAppSnapArray
You can then use this array to further manipulate the snaps. In this example we use it to list out all the snaps(in a text menu) on the volume so we can figure out the snap delta to see how much data a given snapvault or snapmirror has to transfer. I have attached the entire script if you want to see what I am talking about.
With an array, you have the ability to see how "long" it is. $SnapNameArray.length will tell you how many snapshots are in the array. Now if you want to keep five, you would need to build a loop to remove the unwanted snapshots. Now the issue you would have with what I put up is that the oldest snapshosts are on top, and it is easiest to manipulate the array from the bottom. You can use this - [array]::Reverse($NetAppSnapArray)
Now, all you have to do is remove the last item in the array using the loop of your choice to call the last snapshot from the array and delete it until the length of the array = 5.
I don't have the exact code, I can try to put something together, but I at least wanted to give you a path to start looking into.
This sure isn't pretty, but it works. This will get the snaps on a given volume in order of created date. It will then reverse the array order to ensure we get oldest first. From there, by setting "$i =5" We say that anything above item 4 in the array(arrays start at 0 so position 4 is the fifth item), remove that. I recommend testing this somewhere safe just to be sure it works as you expect.