Hi,
I am a newbie of Vmware. Recently I am asked to help with Vmware CLI commands, for example:
Create add block devices (datastore or RDM) to VM
Remove block device (datastore or RDM) from VM
Remove datastore
Add datastore
Add vmdk to a VM
Create CIFS share via CLI
Create NFS export via CLI
I installed Vsphere PowerCLI as well as Vsphere CLI on my PC ...
but would you please help point the right commands since there are so many cmdlet.
btw: we are using ESXi 5.0.0.
one the question: can I finish all of the above with only Vsphere PowerCLI? I don't see the cmdlet related to filesystem in Vsphere PowerCLI............
many thanks in advance:smileyplain:
adding block devices to the vm.
-------------- Example 1 --------------
$vm = Get-VM VM
$vm | New-HardDisk -CapacityKB 10000 -Persistence persistent
Adds to the VM virtual machine a new hard disk in a persistent mode with capacity of 1000 KB.
-------------- Example 2 --------------
$deviceName = ($host | Get-ScsiLun | Where {$_.CanonicalName -match "naa"})[0].ConsoleDeviceName
New-HardDisk -VM $vm -DiskType RawPhysical -DeviceName $deviceName
Obtains a valid device name for Raw Disk Mapping. Then the command creates a RDM hard disk for the specified virtual machine, with the obtained device name.
Remove block device from the VM
remove-harddisk
To add datastore
add-datastore
To remove datastore
remove-datastore
Please refer to http://www.vmware.com/support/developer/windowstoolkit/wintk40u1/html/index.html
thanks! Avarude!
I have a new questio:
Vcenter----->home---->inventory--->host and Clusters, I select an ESX host and ------->configuration----->storage adapter, we can see many LUNs from storage.
We usually right click the "Name" to change the name to match with what we see in stroage side.

soI am wondering if there is any commans we can change the device name?
I tried get-ScsiLun....but not working.......
would you help please point the right command?
So you would like to change only the DisplayName? so that's easy.
Get-Datastore -name xxxx | Set-Datastore -name xxx
Best regards
Max
