Quantcast
Channel: VMware Communities : All Content - VMware PowerCLI
Viewing all articles
Browse latest Browse all 16717

Search for ISOs across all datastores, excluding those 'Inactive'

$
0
0

Hello!

 

I am running into an issue when searching for ISOs. When a datastore is marked as 'Inactive', instead of the script continuing, it is halting on the inaccessible datastore.

 

dir vmstores:\ -Recurse -include *.iso | Select Name,FolderPath

dir : Datastore 'vmrepo1-rep1' is not accessible. No connected and accessible host is attached to this datastore.

At C:\locateisos.ps1:2 char:1

+ dir vmstores:\ -Recurse -include *.iso | Select Name,FolderPath

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-ChildItem], InaccessibleDatastore

    + FullyQualifiedErrorId : VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.InaccessibleDatastore,Microsoft.PowerShell.Commands.GetChildItemCommand

 

Is there a way to pass an exclude arg if the datastore is marked 'Inactive'?


Viewing all articles
Browse latest Browse all 16717

Trending Articles