The Get-VaultFile and Get-VaultFiles commandlets are convenient to use but they have a lot of overhead when creating the file objects, which makes them rather slow when used on a huge dataset. They also have some other restrictions. For example when it comes to searching for dates.


On those cases it is possible to use the Vault API directly to search for files. You have to know that there are separate search functions for folder, file, link, item and custom entities. Though they all work pretty much the same. 

The "" in the attachments contains a module with some sample functions to simplify this procedure a little bit. We had situations when the Find-VaultFiles commandlet was very slow. If this is the case you have to take the code from it and write it directly into your job. It is some weird side effect when the search function was called within a function. usually it should take just a couple of seconds for multiple thousand files.


  1. Define a search condition using the New-SearchCondition function and specify following parameters:
    • PropertyName: The name of the property to search for
    • SearchOperator: The operator that is used for the search e.g. equal or contains
    • SearchRuleType: Must contain or may contain
    • SearchText: The text to search in the specified property
  2. Search for files using Find-VaultFiles:
    • RootFolderPath: Specify the root folder where the search should begin
    • SearchConditions: Pass the result from New-SearchCondition that you executed before
    • RecurseFolders: Specify $true for searching folders recursively
    • LatestFilesOnly: Gets only the latest files
  3. Optionally you can also sort the results using New-SearchSort:
    1. PropertyName: The name of the property
    2. SortAsc: Define $true or $false to sort ascending.


Import-Module powerVault
$searchcondition = New-SearchCondition -PropertyName "Name" -searchOperator Contains -searchRuleType Must -searchText "Drawing"
$result = Find-VaultFiles -RootFolderPath "$" -SearchConditions $searchcondition