# Get-VaultFileBOM Gets the Bill of Materials data from the CAD BOM of the specified file. ## Syntax ```powershell Get-VaultFileBom -File -GetChildrenBy [] ``` ## Parameters ```{eval-rst} .. csv-table:: :header: "Type","Name","Description","Default value","Optional" "String","File","Full path to the file","","no" ":ref:`BomRowVersionType `","GetChildrenBy","| Which version of the children should be retrieved. | Possible options are *LatestVersion, LatestVersion, LatestReleasedVersion and LatestReleasedVersionOfRevision*","*ExactVersion*","yes" ``` ## Return type [FileBomRow[]](/code_reference/objects/filebomrow) ← on success\ **empty** ← on failure ## Remarks The commandlet provides the **Structured** file BOM and supports the following component types: - **Normal:**\  Components with type Normal have no special characteristics and are included in quantity calculations. - **Phantom:**\  Components with type Phantom are ignored in the BOM but their children are promoted and included in the quantity calculations.\ Multiple same components can end up at the same level in the bill of materials when they get promoted.\ They will end up as a single [FileBomRow](/code_reference/objects/filebomrow) with summed quantities. - **Reference:**\  Components with type Reference and their children are ignored in the BOM and are treated as if they do not exist. Read more about the different BOM structures [here](https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Inventor-Help/files/GUID-A0A95805-CBF6-4524-8314-4AC8B53C19CF-htm.html). Similar to the Vault "Assign Items" functionality the cmdlet returns *emtpy* for *iAssembly and iPart factories*, because Vault has no CAD BOM information about them.\ Inventor files with multiple [Model States](https://knowledge.autodesk.com/support/inventor/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/Inventor-Help/files/GUID-8E771DBE-1107-4AE8-BE3E-AF3A7977F3C6-htm.html) only return the BOM data of the *Master Model State*. The different child component search strategies can be specified via **GetChildrenBy** option.\ For strategies different than *ExactVersion*, it is possible that less [FileBomRows](/code_reference/objects/filebomrow) are returned when they where removed in the detected Vault file version.\ Similar as the Vault "Assign Items" functionality, new components that where added in later Vault file versions are returned without *PositionNumber* an with *RowOrder* "0". The cmdlet handles CAD BOMs that contain references to *unresolvable* Vault files and files with *missing CAD BOMs* by returning all the intact and the corrupted [FileBomRows](/code_reference/objects/filebomrow) with all the data it can provide. Accessing other properties can lead to exceptions.\ More information can be found [here](https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Inventor-Help/files/GUID-A0A95805-CBF6-4524-8314-4AC8B53C19CF-htm.html). ## BomRowVersionType ```{eval-rst} .. csv-table:: :header: "Name","Description" "ExactVersion","Get the exact version of the component." "LatestVersion","Get the latest version of the component." "LatestReleasedVersion","Get the latest released version of the component. If no released version is found, the exact version is used." "LatestReleasedVersionOfRevision","Get the latest released version from the same revision. If no released version is found in the Revision, the exact version is used." ``` ## Examples **Display the Structured file BOM for Pad Lock in Console** ```powershell $file = Get-VaultFile -Properties @{Name = "Pad Lock.iam"} $fileBom = Get-VaultFileBOM -File $file._fullPath #Print BOM data as Table like in Inventor $fileBom | sort-object {[int]$_.Bom_PositionNumber} | Format-Table Bom_PositionNumber,Bom_Number,Bom_Structure,Bom_Quantity,Bom_ItemQuantity,Bom_UnitQuantity,Bom_Unit <# Bom_PositionNumber Bom_Number Bom_Structure Bom_Quantity Bom_ItemQuantity Bom_UnitQuantity Bom_Unit ------------------ ---------- ------------- ------------ ---------------- ---------------- -------- 1 100002 Normal 1 1 1 Each 2 100004 Normal 1 1 1 Each 3 100005 Normal 1 1 1 Each 4 100006 Normal 1 1 1 Each 5 100008 Normal 1 1 1 Each 6 100011 Normal 1 1 1 Each 7 100010 Normal 1 1 1 Each 8 100003 Normal 1 1 1 Each 9 100012 Normal 1 1 1 Each 10 100016 Normal 1 1 1 Each 11 100009 Normal 1 1 1 Each #> ``` **Get FileBOM data for assembly with new component in LatestReleasedVersion of Phantom** ```powershell $fileBom = Get-VaultFileBOM -File "$/Designs/AssemblyWithPhantom.iam" -GetChildrenBy LatestReleasedVersion $fileBom | Format-Table Bom_RowOrder,Bom_PositionNumber,Bom_Number,Bom_Structure,Bom_Quantity,Bom_ItemQuantity,Bom_UnitQuantity,Bom_Unit <# Bom_RowOrder Bom_PositionNumber Bom_Number Bom_Structure Bom_Quantity Bom_ItemQuantity Bom_UnitQuantity Bom_Unit ------------ ------------------ ---------- ------------- ------------ ---------------- ---------------- -------- 0 NewPart Normal 1 1 1 Each 2 5 Part2 Normal 2 2 1 Each #> ``` **Skip BomRows of unconditionally removed or erroneous file components** ```powershell $fileBom = ( Get-VaultFileBOM -File "$/Designs/CorruptFileBom.iam" -GetChildrenBy LatestVersion ) | foreach { try { $successfullyRetrievedBomNumber = $_ | Select-Object -ExpandProperty Bom_Number return $_ } catch { # Skip unconditionally removed or erronous file component, similar as Vault "Assign Items" functionality } } ```