Hey all,
I recently bought the awesome book VMware vSphere PowerCLI Reference: Automating vSphere Administration and have been working on a modified script of the VM mass deployment.
I know it's not the most pretty code but it's a work in progress.
I have a csv-file, MassVMs.txt, with a "HardDisk" column and a "Cluster" column.
I want the script to take a random host in cluster X (from the csv-file) where the minimum avaliable disk is 1.1 times harddisk Y (from the csv-file).
Import-Csv .\MassVMs.txt|
The random host in Cluster X-part works great, $_.Cluster retrieves the specified cluster from the file.
Howerver $_.HardDisk doesn't as it seems, the scrip runs without errors and outputs all datastores in the cluster. If I replace "$_.HardDisk" with e.g. 100 it works as it should.
My conclusion is that maybe some command breaks the "connection" to the file? Or that I'm simply doing completely wrong. Anyone got any pointers?