Hi All,
I am not a big fun/specialist of .NET platform etc. So maybe it is simple question.
My problem is with VMware.vim.dll library. I know that this is a core powercli dll.
I know how to import it to powershell by "simply": $tmp = [Reflection.Assembly]::LoadWithPartialName("VMware.Vim").
Also that $tmp | get-member works fine and returns all methods and property.
Problem is that I can't get information about included objects, for example about vmware.vim.dvportgroupconfigspec.
How can I list vmware.vim.dll library for such object (argument to function new-object)?
Hope it is possible in simple way.
Regards
Not sure I get the question ?
Do you want to extract the constructors (with parameters) for the all the objects ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes.
Simply I want to get list of object from vmware.vim.
Just to get information that there is a vmware.vim.dvportgroupconfigspec or VMware.Vim.ManagedObjectReference.
How can I get this information?
Regards
Try something like this
[AppDomain]::CurrentDomain.GetAssemblies() | where {$_.GetName().Name -match "^VMware.Vim$"} | %{
$_.GetExportedTypes() | where {$_.DeclaredConstructors} | %{
$_ | Select FullName, Module,
@{N="Constructor";E={[string]::Join(',',($_.DeclaredConstructors | Select -ExpandProperty Name))}},
@{N="Fields";E={[string]::Join(',',($_.DeclaredFields | Select -ExpandProperty Name))}}
}
} | Sort-Object -Property FullName
The script is not optimal when an object has multiple constructors I'm afraid.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference