Have a look at .
In the script I wrote for that thread you could change the matchpattern property of the HostDatastoreBrowserSearchSpec object to contain the name of the file for which you want to know the size.
...
$searchSpec.matchpattern = "file1"
...
Another option is to get all files in the folder ("\[datastore1\]/folder1" and then use a loop to find the specific file you are looking for.
...
foreach ($result in $task.info.Result){
foreach($file in $result.File){
if($file.Path -eq "file1"){
$file.Path $file.fileSize
}
}
}