znip
Contributor
Contributor

New-Harddisk on a New-ScsiController when PoweredOn. Moment-22.

On a running VM I would like to add some new harddisks. Those disks should be spread out on new virtual ScsiControllers.

This is done very easily in GUI. But PowerCLI seeams unable to do this on a PoweredON VM. 

- New-Harddisk can take Controller as a parameter, but since the controller does not exist yet....

- New-Scsicontroller can take disks as a parameter, but can not change when VM is poweredOn. And I cannot create a SCSI-controller without any disks.

Moment-22

So I have to resort to GUI. Or? Ideas are welcome!

/ChZ

Tags (1)
0 Kudos
5 Replies
znip
Contributor
Contributor

Moment 22 is translated to Catch 22 in english... :smileysilly:

0 Kudos
MartinAmaro
Expert
Expert

Hmmmm did you try this 

----- Example 1 --------------

$vm = Get-VM VM | New-HardDisk -CapacityKB 10485760 | New-ScsiController

http://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/New-ScsiController.html

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful.
0 Kudos
znip
Contributor
Contributor

Yes. No luck.

PS F:\Scripts> $vm | New-Harddisk -CapacityKB (60GB/1KB)   -Datastore "B209-SESOEX0001-BASE" | New-ScsiController -Type ParaVirtual
New-ScsiController : 2012-07-05 15:59:18    New-ScsiController        The VM must be in the following state: PoweredOff
.
At line:1 char:99
0 Kudos
MartinAmaro
Expert
Expert

Yeah it looks like it must be power off if you use those cmdlets. have you tried using "VirtualMachineConfigSpec" ?

http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.vm.ConfigSpec.html

See LucD example

http://www.lucd.info/2009/12/08/switching-to-the-paravirtual-scsi-controller/

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful.
0 Kudos
riahc3
Contributor
Contributor

That isnt working either...

0 Kudos