Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 236824

Re: Problem new-vm within a script specifying more than 1 disk

$
0
0

That's actually where the problem lies, I'm reading in a csv file and assigning the values to variables which I have on the new-vm line.  So at present it looks something like..

 

......DiskSize......

 

......,"1,1".....

 

 

$VM_Disk = Parameter.DiskSize

 

New-VM ... -DiskGB $VM_Disk

 

The $VM_Disk variable is assigned 1,1 properly, and if I step through the script or write out to screen whats being executed at the New-VM line its correctly entered as -DiskGB 1,1.  But when the actual cmdlet runs it does something with the 1,1 and drops the comma.  Looking at the expected value type -DiskGB runs on a decimal value, but $VM_Disk is being reported as a string value.  If I run [decimal]$VM_Disk it drops the comma from the value also giving me 11.  Somehow when you run just the cmdlet without it being part of a script with a fed in value it's fine accepting the 1,1 and will generate two 1G disks.  But when you feed it the numbers in a script I can only assume its running a value type conversion to change the string to a decimal.  I tried playing around with value conversions telling it the variable contained an integer but that led to the same results.


Viewing all articles
Browse latest Browse all 236824

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>