VMware Cloud Community
Marcel00M
Contributor
Contributor

add existing vmdk with new-HardDisk doesent work with 2008R2VM (ArgumentOutOfRangeException)

Hello together,

there is a very strange behavior.

I want to add a drive from a Windows Server 2003 VM to an Windows Server 2008R VM.

I use this

New-HardDisk -VM $vm -DiskPath "[storage1] OtherVM/OtherVM.vmdk"

Its woks with Windows Server 2003 VMs but the same command (same datastore, same vmdk, everthing same) does not work with the Windows Server 2008R2 VM´s (all cloned from a master)

With the gui it also works for the 2008R2 VM. Virtual Hardware is the same Version. Each 2008R2 VM is affected from this behavior. Even mounting a vmdk from another 2008R VM

to an 2008R2 VM doesent work (Buts that also works for the 2003 VM).

The strangest Thing is:

Even when I remove the original *.vmdk from the 2008R2VM via gui and want to add it with  New-HardDisk again, I get the same error.

Also when the disk allreday mountet the error occurs (imho powercli doesent even check that and runs in the problem)

Thats the error message:

"

New-HardDisk : Der Index lag außerhalb des Bereichs. Er muss nicht negativ und kleiner als die Auflistung s

Parametername: index

At line:1 char:13

+ new-HardDisk <<<<  -VM 1mig2008 -DiskPath "[VM_pT_214] 1mig2008/1mig2008_1.vmdk"

    + CategoryInfo          : NotSpecified: (:) [New-HardDisk], ArgumentOutOfRangeException

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

Translatet by me:

The Index was out of range. It does not have to be negative and lesser than the listing's


Can some one help me ore give me a hint?


ESX = 4.0.0

vSphere = 4.0.0

Virtual Hardware = 7


Thank You

0 Kudos
6 Replies
LucD
Leadership
Leadership

And which PowerCLI version are you using ?

Can you do a

Get-PowerCLIVersion


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

0 Kudos
Marcel00M
Contributor
Contributor

ahh sorry:

VMware vSphere PowerCLI 4.0 U1 build 208462

0 Kudos
LucD
Leadership
Leadership

Ouch, that's an older version (3.5 years). And it doesn't seem to support W2K8R2, see the 4.0.1 Release Notes.

Any chance of upgrading to the latest ?

The latest build supports ESXi 4 Update 4, see the 5.1 R2 Release Notes.


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

Marcel00M
Contributor
Contributor

I just have to update the local Powercli Vresion on my wokstation/maintain VM(?)

That should be done until eobd.

0 Kudos
LucD
Leadership
Leadership

That is correct, but watch out, if you're using pre-ESXi 4 Update 4 systems, you might run into other problems.


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

0 Kudos
Marcel00M
Contributor
Contributor

Each time I search here for script solutions:

LucD posts the solution and also this time You were right. I installed the 5.1 R2 and the cmldet works. Thank You Smiley Happy

Regarding possible other problems:

I have 2 maintaine VMs to run powercli scripts etc . The mainscript VM still has the 4.0  version installed and the other one the 5.1 R2

so i can figure out problems and compare.

0 Kudos