I try to stay far away from Python, but I guess that code is trying to do something like this.
Refresh the certificate on all ESXi nodes.Connect-VIServer -Server 'vCenterName' -Port 443 -User 'UserName' -Password 'Password'
$si = Get-View ServiceInstance
$viewMgr = Get-View -Id ViewManager
$recurse = $true
$cViewMoRef = $viewMgr.CreateContainerView($si.Content.RootFolder,'HostSystem',$recurse)
$cView = Get-View -Id $cViewMoRef
$certMgr = Get-View -Id $si.Content.CertificateManager
$certMgr.CertMgrRefreshCertificates_Task($cView.View)Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
thank for your quick response .
yes you are correct i was trying to use same way as we use in powercli.
Can you please suggest
why we Do not do see method related to managed object until we pass their ID again to get-view
cm|gm It usually provide no method to refresh
cmgr=get-view -id cm. # passing id of certificate manager
I will get all methods
any technical logic behind this ?
i was in assumption line 1 provide ID to me
then another view for corresponding object
but i have seen some managedObject directly provide method in first command only
get-view sessionmanager will give all method and we do not need 2 nd line where we pass ID
That is the only roadblock in python i am facing
i created the view but no method is coming
That is because you are working with a MoRef (Managed Object Reference), not an object.
All methods and properties are available through the object, not the MoRef.
View the MoRef as a kind of pointer to the actual object.
To go from a MoRef to the corresponding object you use the Get-View cmdlet.Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz1 person found this helpful