VMware Cloud Community
rpotru
Enthusiast
Enthusiast

script needed to add disk to 170 VM's

I have 170+ VMs that need to have 2 drives added to them: 1 4GB and 1 20GB. 
They also need to be aligned to a specific data store.
I can do this all manually by going to vSphere Client -> Edit Settings -> Add hard disk (couple of times).

I executed the following script through CLI.

vdiskcreate.pl --server esx-host-06 --username root --password pass --vmname TestVM2 --filename abcd.vmdk --disksize 4096
Can't call method "key" on an undefined value at C:\Program Files\VMware\VMware vSphere CLI\Perl\apps\vm\vdiskcreate.pl line 82.

End Disconnect

Any ideas to remove that error? Also How can i automate this to do for all 150 VM's instead of executing this command 150 times.

I would really appreciate your help.

Thanks,

Raj.

0 Kudos
2 Replies
a_p_
Leadership
Leadership

Discussion moved from VMware ESX™ 4 to VMware vSphere™ PowerCLI

I think the guys in this forum will come up with a solution for you really fast.


André

0 Kudos
LucD
Leadership
Leadership

Since a Perl script is mentioned, I think the thread is better off in this Community.


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

0 Kudos