Hi Charmer
Regarding the FileSpec Expression. I saw in your PS code that you processing only files with names that contain the value passed
by parameter $FileName, so I did the same with User::VarFileName and FileSpec Expression.
#Loop over files in specified directory
$files = get-childitem $RootDir -recurse | Where-Object {$_.Name -match $FileName }
Best regards
Mike