It has to do with how PowerShell formats output. It gets a little bit into some of the details so if you don't care, feel free to skip down to the punchline below.
Details here:
The story goes something like this: The PowerShell console adds a "| Out-Default" to everything you enter in the console. So when you do things a line at a time, there's a single "| Out-Default" added to each line behind the scenes. When you don't specify the formatting, it figures things out. When you do specify the formatting as in "| Format-Table", it uses the specified formatting. So now let's think about your script. The console is going to add a "| Out-Default" to your script invocation. We can sort of unfold the script invocation to see what the console is actually executing. It's something like this:
&{Get-VIServer -Server xxx.xxx.xxx.xxx -User username -Password password; Get-VM | Get-Snapshot | ft { $_.vm.name },name,created} | Out-Default
In case you haven't gotten that far in PowerShell yet, the &{...} construct is defining a script block and evaluating it. This is the logical equivalent of what happens when you invoke the script. The result of all that then gets piped to Out-Default and we've now duplicated the failure on the command-line.
The reason this fails is that the Out-Default cmdlet is getting confused. It's getting an unformatted object (the result of Get-VIServer) along with some formatted objects coming from Format-Table (the object of type "Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" that you see in the error message). And it doesn't know how to resolve the combination of formatted and unformatted objects.
Punch line here:
So you have a few choices:
1. don't try to format in which case the default should be able to do something reasonable (this is probably not what you want but it is an option)
2. don't let the result of Get-VIServer into the output stream. That's what Niket's solution does by assigning it to a variable. You could achieve the same by redirecting it to $null:
Get-VIServer -Server xxx.xxx.xxx.xxx -User username -Password password > $null
Get-VM | Get-Snapshot | ft { $_.vm.name },name,created