VMware Cloud Community
kpeterat
Contributor
Contributor
Jump to solution

QueryUnresolvedVMFSVolumes() returns nothing

Hi @all,

i'm building a PowerShell script to mount snapshot LUNs in a DR case. But my QueryUnresolvedVMFSVolumes returns nothing within my script. If i use all lines manually i get the expected return. Within the script there is nothing. Can someone help?!?

function Getunresolved()
     {
          $hostdetail = Get-VMHost $vmhosts[0]
          $hostview = get-View $hostdetail.Id
          $hostss = get-view $hostview.ConfigManager.StorageSystem
          $hostds = get-view $hostview.ConfigManager.DatastoreSystem
          $hostss.RefreshStorageSystem()
          $hostuvmfs = $hostds.QueryUnresolvedVMFSVolumes()
          Write-Host $hostuvmfs.count
     }

Thanks Klaus

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Perhaps try waiting between the RefreshStorageSystem and QueryUnresolvedVMFSVolumes calls.

Put for example a 'sleep 10' cmdlet between those 2 calls.

You probably have to play with the duration


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Perhaps try waiting between the RefreshStorageSystem and QueryUnresolvedVMFSVolumes calls.

Put for example a 'sleep 10' cmdlet between those 2 calls.

You probably have to play with the duration


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
kpeterat
Contributor
Contributor
Jump to solution

Thanks LucD, it works now.....

0 Kudos