Your code just plain does not work. If I had an inkling of what you are trying to do, I might make some suggestions but I am at a loss.

I don't know how you are supposed to get BOTH the $User AND the $Computer from the same var.
$User = Left ($UserDir,2)
$Computer = Left ($UserDir,4)

It simply fails all the IFs and falls through to the end, where you ReDim() to a negative number and that throws the error.

I guess you did not run this in debug cuz you would have seen that.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.