Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

New-VHD : Cannot bind parameter 'SizeBytes'. Cannot convert value "2GB" to type "System.UInt64".

$
0
0

Hi there,

I have a csv file which looks like:

DriveName;Size
Drive_D;10GB

Then I use following two commands to create a new vhd file.

$disk=import-csv -Path C:\temp\Drives.csv -Delimiter ";"

$disk | select * -first 1 | %{New-VHD –Path C:\ClusterStorage\Volume1\Server1\Server1_$($_.DriveName).vhdx –SizeBytes $_.Size -Fixed}

However, I get following error message:

New-VHD : Cannot bind parameter 'SizeBytes'. Cannot convert value "2GB" to type "System.UInt64". Error: "Input string was not in a correct format."
At line:1 char:127
+ ... hdx –SizeBytes $_.Size -Fixed}
+                    ~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-VHD], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Vhd.PowerShell.NewVhdCommand

Any hint how I can get this to work?

Regards

Gunter


Cheers, Gunter


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

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