Hi Luc ,
is it possible to understand vm methods from the definition property under extension data .(instead of
getting from https://vdc-repo.vmware.com/vmwb-repository/dcr-public/6b586ed2-655c-49d9-9029-bc416323cb22/fa0b429a...
You can only get the number of parameters and the type of each parameter that way.
The actual explanation of what the method does and the description and content of the parameters is only available in the API Reference afaik.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can only get the number of parameters and the type of each parameter that way.
The actual explanation of what the method does and the description and content of the parameters is only available in the API Reference afaik.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
i am trying to see description of the following method
if yu can suggest the right place to get this as i did not find in the api expolrer i posted earlier.
You have to use the latest version of the API Reference.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thnaks Luc ,
below is what i got .i want to use this as reference example to create other methods .
if i compare these three parametrs (_this,mask,completemasks)correspond to $vm ,$featuremasks and $true.
In this method the $this refers to $vm.ExtensionData, the VirtualMachine object.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
if you could help me creating a similar task for adding disk_task in this post ..
this has only one datastore and vm has only one harddisk.
below is what i intend to perform based on the attach disk_method .
however i find this task little confusing as it does not ask for the size of the harddisk .
i think i need to use reconfigure vm task for adding new hard disk to vm .
Not necessarily.
If your VM is at HW version vmx-13 or higher and you just want to connect 1 existing harddisk to the VM, then you can use the AttachDisk method.
Do you want an example for AttachDisk?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
actually i need example of adding new disk to vm using methods available in vm.extensiondata.
This is what I think is currently the minimum settings to add a VMDK to a VM.
There is 1 known flaw in there.
While calculating the next UnitNumber, the code doesn't take into account the maximum number of devices that can be connected to a controller.
$dsName = 'MyDS'
$vm = Get-VM -Name $vmName
$ds = Get-Datastore -Name $dsName
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$devSpec = New-Object VMware.Vim.VirtualDeviceConfigSpec
$devSpec.Operation = [vmware.vim.VirtualDeviceConfigSpecOperation]::add
$devSpec.FileOperation = [vmware.vim.VirtualDeviceConfigSpecFileOperation]::create
$dev = New-Object VMware.Vim.VirtualDisk
$dev.CapacityInKB = 1GB/1KB
$dev.Key = -100
$dev.ControllerKey = (Get-ScsiController -VM $vm -Name 'SCSI controller 0').ExtensionData.Key
$dev.UnitNumber = ((Get-HardDisk -VM $vm | where{$_.ExtensionData.ControllerKey -eq $dev.ControllerKey}).ExtensionData.UnitNumber |
Measure-Object -Maximum).Maximum + 1
$devBack = New-Object VMware.vim.VirtualDiskFlatVer2BackingInfo
$devBack.DiskMode = [VMware.Vim.VirtualDiskMode]::persistent
$devBack.ThinProvisioned = $true
$devBack.Datastore = $ds.ExtensionData.MoRef
$devBack.FileName = "[$dsName]"
$dev.Backing = $devBack
$devSpec.Device = $dev
$spec.DeviceChange += $devSpec
$vm.ExtensionData.ReconfigVM($spec)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc,
unlike other methods this is little not self explanatory in the document .
is there any other resource other than for spec
Besides the Reference, there are also some User Guides.
They are written for specific frameworks, but you can still pick up quite a bit from those.
This for example for the .NET framework.
For the basics, there is also Steve Jin's VMware VI and vSphere DSK book.
It is written for Java and covers a rather old vSphere version, but this is a good study guide (provided you can at least read the Java examples).
And besides those, it's a matter of practising and looking at examples from others.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks