Hello.
I'm trying to user the PowerShell command resize-partition as part of a RunBook task so I need to be able to specify the size as a variable. The -size element requires that you also add on the size type (e.g. kb, mb, gb, tb etc.) but this makes the command fail as its then passed as a string and it looks like it wants to be a UInt64.
I have tried various different ways such as:
$size = 300 + "gb"
$size = "300" + "gb" etc.
The error I get is:
PS C:\Windows\system32> Resize-Partition -DriveLetter E -Size $Size
Resize-Partition : Cannot process argument transformation on parameter 'Size'. Cannot convert value "300GB" to
type "System.UInt64". Error: "Input string was not in a correct format."
The only way I can get it working is to hardcode it in: '-size (300gb)'
Would anyone have any idea how to get this working? It must be possible.
Thanks, Joe