Attempting to run any cmdlet produces a null set and the "A parameter cannot be found that matches parameter name 'file'." warning if $file exists as a global variable.
This appears to be because line 702 is referencing the $file variable that is not set previously in the script. If $file exists from any other script, this will throw errors.
Suggesting check be removed entirely, if not necessary, or that the $file variable is initialized and scoped for use on line 702.
Attempting to run any cmdlet produces a null set and the "A parameter cannot be found that matches parameter name 'file'." warning if $file exists as a global variable.
This appears to be because line 702 is referencing the $file variable that is not set previously in the script. If $file exists from any other script, this will throw errors.
Suggesting check be removed entirely, if not necessary, or that the $file variable is initialized and scoped for use on line 702.