Luc,
You are right! I did not want to move vm config files and did not copy "$spec= New-Object VMware.Vim.VirtualMachineRelocateSpec".
Now problem solved and it's working as I want.
Let me ask you something else, please.
I attached the script that I am going to use to convert VMs from thin to thick.
Right now it's working for 1 single VM, but I am going to change it. The problem I am facing is with harddrives. In the script I am using VM that has 2 harddrives (I just know it:) and I am specifiying parameters for 2 harddrives in advance just because I know there are 2 harddrives. But how should I adjust the script if there will be different (unknown in the beging) numbers of harddrives (from 1 to 5)? How can I find all harddrives on VMs, correlate them with datastores (few might be on the same datastore) and use it later on in the script?
Thanks a lot!
Please let me know if you want me to open new discussion for this topic.
UPD: I can use $diskNumber= $VM.HardDisks.Count, count disks and write different "if" for different numbers, but I think there is should be better solution