From the code snippet provided, it looks like your $msiPath should be of type IO.FileInfo.

Since we cannot see the $prereqComponent object classification, it may be useful to assign the fully qualified path name (FQPN, such as: C:\Users\Me\Desktop\File), or ensure the $msiPath above is of type IO.FileInfo.