Hello scripting gurus,
I m new to vi toolkit and powershell.
Can anybody help me to understand ho to reference and how to call config.hardware.device and how to obtain information and I d appreciate if you can provide me a good manual about this staff.
My problem i s to understand how to reference and how to locate for example backing runtime for vm etc.
Im going mad ...please help me
the script to understand is below and the problem is how to obtain information underlined
thank you very much
cheers
Connect-VIServer MYVISERVER
$report = @()
$vms = Get-VM | Get-View
foreach($vm in $vms){
foreach($dev in $vm.Config.Hardware.Device){
if(($dev.gettype()).Name -eq "VirtualDisk"){
if($_dev.Backing.CompatibilityMode_ -eq "physicalMode"){
$row = "" | select VMName, HDDeviceName, HDFileName
$row.VMName = $vm.Name
$row.HDDeviceName = $dev.Backing.DeviceName
$row.HDFileName = $dev.Backing.FileName
$report += $row
The VITK provides a collection of cmdlets that will allow you to manage most of your daily VI-related tasks.
But the VI environment contains many more objects and methods that are exposed via the SDK APIs.
Sometimes you need to revert to the SDK to access specific information or to use specific methods.
This subject has been discussed on previous occasions in this forum.
See for example .
There are also a number of bloggers that have written excellent articles on this subject.
To name a few:
vinternal's VI Toolkit Mastery
Hugo's Power to the API
and there are many more. Google away
Hope this helps you understanding the properties you asked for ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
very useful explanation, and same thing for invoke method ?
thnak you again I can now begin scripting ...........
thank you very much