powerJobs cmdlets fail with 080004005 when using InventorServer
Description
When using InventorServer, Open-Document, Export-Document, Close-Document fails with
"Unspecified error (Exception from HRESULT: 080004005 (E_FAIL))
Cause
In some situations InventorServer will run into this error when the active project file points to design data folder that doesn't exist or doesn't contain any design data
Solution
Download project file from Vault and ensure that DesignData and Styles are available where the project file is looking for them
-
Create C:\ProgramData\coolOrange\powerJobs\Modules\SaveVaultFileWithProject.psm1 with
function SaveVaultFileWithProject {
param (
$VaultFilePath,
[bool]$FastOpen = $false
)
Write-Host ">> $($MyInvocation.MyCommand) >>"
Write-Host "VaultFilePath: $VaultFilePath"
Write-Host "FastOpen: $FastOpen"
$result = @{
Result = $true
Files = @()
ProjectFile = $null
}
$localWorkingFolder = Join-Path -Path ($vaultConnection.WorkingFoldersManager.GetWorkingFolder('$')).FullPath -ChildPath "Designs"
Remove-Item -LiteralPath $localWorkingFolder -Recurse -Force -ErrorAction SilentlyContinue
$ipjVaultPath = $vault.DocumentService.GetInventorProjectFileLocation()
$result.ProjectFile = (Save-VaultFile -File $ipjVaultPath) | Select-Object -First 1
$result.Files = Save-VaultFile -File $VaultFilePath -ExcludeChildren:$FastOpen -ExcludeLibraryContents:$FastOpen
if (-not $result.ProjectFile -or $result.Files.Count -lt 1) {
$result.Result = $false
$result.Files.Clear()
$result.ProjectFile = $null
}
$null = New-Item -Path $workingDirectory -ItemType Directory -Force
return $result
}
-
Instead of Save-VaultFile, use SaveVaultFileWithProject in your script and use the Project option in Open-Document
$downloadResult = SaveVaultFileWithProject -VaultFilePath $file._FullPath -FastOpen $false
$localFile = $downloadResult.Files[0]
$openResult = Open-Document -LocalFile $localFile.LocalPath -Application 'InventorServer' -Options @{
Project = $downloadResult.ProjectFile.LocalPath
FastOpen = $fastOpen
}
-
On the jobprocessor machine manually copy the design data and inventor styles where they are expected by the project file. For most people those files are stored in Vault and can simply be downloaded with "Get.."
Inventor styles are not confirmed to cause issues and are just loaded for ensurance.
When changes are made to those files they should be updated on the job machine