the issue does not occur when i substitute the command parameter, however, the execution time went thru the roof, as i expected.
Seconds : 24
Milliseconds : 93
(Measure-Command Statistic)
I believe thats because of the string parameter, that forces get-harddisk cmdlet to create a VirtualMachine object (i believe it calls Get-VM, which is very, VERY slow. Thats why i used the Get-View with -ViewType in the first place).
Luc, is there anyway i can make this quickier without the Get-VIObjectByVIView? I tested many options while creating this script and this proved to be the most efficient one, with runtimes around 1 to 2 seconds in the same environment (as i said, the script randomly fails with the disconnection issue, sometimes i can make it work and its pretty fast )