VMware Cloud Community
adrianallan
Contributor
Contributor

error new-harddisk cmdlet - Index out of Range

I've tried to replace the name with a variable $blah = get-vm aaatest and even the diskpath with a variable but I get the same error as shown below

Any advice would be appreciated

The othervm that it is getting the disk from is in the powered off state

PS C:\> New-HardDisk -VM aaatest -DiskPath "[LUNName] OtherVM/OtherVM.vmdk"

New-HardDisk : Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

At line:1 char:13

+ New-HardDisk <<<< -VM aaatest -DiskPath "[LunName] OtherVM/OtherVM.vmdk"

+ CategoryInfo : NotSpecified: (Smiley Happy , ArgumentOutOfRangeException

+ FullyQualifiedErrorId : System.ArgumentOutOfRangeException,VMware.VimAutomation.Commands.NewHardDisk

Tags (1)
0 Kudos
4 Replies
LucD
Leadership
Leadership

Works fine for me.

Which PowerCLI and PowerShell version are you using ?

Get-PowerCLIVersion
$psversiontable.buildversion

Against which Virtual Center/vCenter and ESX/ESXi version are you running this ?

And on which platform are you running this ?

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
adrianallan
Contributor
Contributor

PowerCLI Version

-


VMware vSphere PowerCLI 4.0 U1 build 208462

PS C:\> $psversiontable.buildversion

Major Minor Build Revision

6 0 6002 18111

Major - 6

Minor - 0

Build - 6002

Revision - 18111

Name Value

-


-


CLRVersion 2.0.50727.3603

BuildVersion 6.0.6002.18111

PSVersion 2.0

WSManStackVersion 2.0

PSCompatibleVersions {1.0, 2.0}

SerializationVersion 1.1.0.1

PSRemotingProtocolVersion 2.1

0 Kudos
LucD
Leadership
Leadership

And against which vCenter and ESX versions are you trying to run the cmdlet ?

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

adrianallan
Contributor
Contributor

I am hitting a 3.5 server Patch level 4 I beleive

We will be upgrading to vSphere by the end of the year or next year.

0 Kudos