Search K
Appearance
Appearance
MinuteView Server provides a set of PowerShell cmdlets that enable users to query and extract data directly from Autodesk Vault using the REST API. These cmdlets are designed for read-only access and do not consume Vault CAL licenses, making them ideal for automated reporting, data extraction, and integration scenarios.
This article demonstrates how to leverage custom PowerShell scripts to query Vault data via the PostData endpoint and extract information using the MinuteView PowerShell cmdlet library.
Before querying Vault data, you must establish a connection using the Open-VaultConnReadOnly cmdlet. This creates a read-only REST API connection that does not consume a license.
# Establish a read-only connection to Vault
Open-VaultConnReadOnly -Server "vault-server.company.com" `
-VaultName "ProductionVault" `
-UserName "service-account" `
-Password "SecurePassword123"$vRestConnFor simple "contains" searches, use the BasicContainsConditions parameter with a hashtable:
# Find all files where the filename contains "Pump"
$results = Find-VaultFiles -Types "File" `
-LatestOnly $true `
-BasicContainsConditions @{
"NAME" = "Pump"
}
# Display results
$results | Format-Table# Search for files containing "Pump" in the name AND "Released" in the state
$results = Find-VaultFiles -Types "File" `
-LatestOnly $true `
-BasicContainsConditions @{
"NAME" = "Pump"
"State" = "Released"
}For exact matches or other comparison operators, use the Create-SearchCondition cmdlet with the AdvancedSearchConditions parameter.
# Create an exact match condition for a specific part number
$condition = Create-SearchCondition -PropertyName "Part Number" `
-Condition "IsExactly" `
-Value "PMP-12345-REV-A"
# Execute the search
$results = Find-VaultFiles -Types "File" `
-LatestOnly $true `
-AdvancedSearchConditions @($condition)
# Display results
$results | Select-Object name, @{Name='FileId';Expression={$_.id}}, createDate# Create multiple search conditions
$nameCondition = Create-SearchCondition -PropertyName "NAME" `
-Condition "IsExactly" `
-Value "Motor_Assembly.iam"
$stateCondition = Create-SearchCondition -PropertyName "State" `
-Condition "IsExactly" `
-Value "Released"
$dateCondition = Create-SearchCondition -PropertyName "Date Modified" `
-Condition "GreaterThan" `
-Value "2024-01-01"
# Combine conditions (AND logic)
$results = Find-VaultFiles -Types "File" `
-LatestOnly $true `
-AdvancedSearchConditions @($nameCondition, $stateCondition, $dateCondition)-Types (Required) Specifies the entity type to search. Valid values:
# Search for folders
$folders = Find-VaultFiles -Types "Folder" `
-LatestOnly $true `
-BasicContainsConditions @{"NAME" = "Drawings"}-LatestOnly (Required) Determines whether to return only the latest version of files:
# Get all versions of files named "Assembly"
$allVersions = Find-VaultFiles -Types "File" `
-LatestOnly $false `
-BasicContainsConditions @{"NAME" = "Assembly"}# Connect to Vault
Open-VaultConnReadOnly -Server "vault.company.com" `
-VaultName "Engineering" `
-UserName "report-service"
# Search for released drawings
$stateCondition = Create-SearchCondition -PropertyName "State" `
-Condition "IsExactly" `
-Value "Released"
$extensionCondition = Create-SearchCondition -PropertyName "File Extension" `
-Condition "IsExactly" `
-Value "dwg"
$drawings = Find-VaultFiles -Types "File" `
-LatestOnly $true `
-AdvancedSearchConditions @($stateCondition, $extensionCondition)
# Export to CSV
$drawings | Select-Object name,
@{Name='FileId';Expression={$_.id}},
createDate,
@{Name='CreatedBy';Expression={$_.createUserName}},
@{Name='Size';Expression={$_.fileSize}} |
Export-Csv -Path "C:\Reports\ReleasedDrawings.csv" -NoTypeInformation
Write-Host "Exported $($drawings.Count) drawings to CSV"# Calculate date 30 days ago
$thirtyDaysAgo = (Get-Date).AddDays(-30).ToString("yyyy-MM-dd")
# Create search condition
$dateCondition = Create-SearchCondition -PropertyName "Date Modified" `
-Condition "GreaterThanOrEqualTo" `
-Value $thirtyDaysAgo
# Find recent files
$recentFiles = Find-VaultFiles -Types "File" `
-LatestOnly $true `
-AdvancedSearchConditions @($dateCondition)
# Group by user
$recentFiles | Group-Object -Property modifyUserName |
Select-Object Name, Count |
Sort-Object Count -Descending# Find files where "Description" property is empty
$emptyDescCondition = Create-SearchCondition -PropertyName "Description" `
-Condition "IsEmpty" `
-Value ""
$filesNeedingDesc = Find-VaultFiles -Types "File" `
-LatestOnly $true `
-AdvancedSearchConditions @($emptyDescCondition)
Write-Host "Found $($filesNeedingDesc.Count) files missing descriptions"# Search by custom Vault properties
$projectCondition = Create-SearchCondition -PropertyName "Project Code" `
-Condition "IsExactly" `
-Value "PRJ-2024-001"
$costCenterCondition = Create-SearchCondition -PropertyName "Cost Center" `
-Condition "Contains" `
-Value "Engineering"
$projectFiles = Find-VaultFiles -Types "File" `
-LatestOnly $true `
-AdvancedSearchConditions @($projectCondition, $costCenterCondition)
# Calculate total file count and size
$totalSize = ($projectFiles | Measure-Object -Property fileSize -Sum).Sum
Write-Host "Project has $($projectFiles.Count) files totaling $([math]::Round($totalSize/1MB, 2)) MB"These cmdlets work seamlessly with MinuteView's PostData endpoint for Vault. You can call custom PowerShell scripts via the API to extract data on-demand:
# Example script that can be invoked via PostData endpoint
param(
[string]$PartNumber
)
# Connection is already established by the PostData handler
# Query for the specific part
$condition = Create-SearchCondition -PropertyName "Part Number" `
-Condition "IsExactly" `
-Value $PartNumber
$results = Find-VaultFiles -Types "File" `
-LatestOnly $true `
-AdvancedSearchConditions @($condition)
# Return results as JSON for the API response
$results | ConvertTo-Json -Depth 10Property names must match the display names shown in the Vault UI. Common properties include:
Any custom properties defined in your Vault configuration can be queried using their display names.
Finding Property Names
To find exact property names, log into Vault and check the property dialog or contact your Vault administrator.
$true for most queries to avoid retrieving all file versionsBasicContainsConditions or AdvancedSearchConditions must be providedFor more advanced Vault querying capabilities, see:
Need Help?
If you have questions about using PowerShell cmdlets with MinuteView Server, contact support or check our FAQ section.