• ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
  • ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
Guidelines
Join the HP Community Solve‑a‑thon | Help Others & Share Your Solutions | Live on Zoom | 2:30 PM to 2:30 AM IST | Every Wednesday Click here to know more
Check out our WINDOWS 11 Support Center info about: OPTIMIZATION, KNOWN ISSUES, FAQs, VIDEOS AND MORE.
HP Recommended

I was attempting to automate HP Image Assistant (HPIA) using PowerShell (SYSTEM context), and ran into several issues that seem common but not clearly documented.

Initial approach:

  • Download hp-hpia-5.3.5.exe
  • Run with /Silent and other switches
  • Expect analysis/report output

Observed problems:

  • The downloaded EXE does not behave like a true CLI tool
  • Silent execution still triggers unexpected behavior
  • Script “runs” but does not reliably produce usable output
  • No clear indication of success vs failure
  • Paths and output locations are inconsistent
  • Automation breaks under SYSTEM context

Root Cause (Key Finding)

The main issue is that:

The HPIA download EXE is a wrapper, not the actual automation binary

Reliable automation requires:

  1. Extracting the EXE first
  2. Locating and running HPImageAssistant.exe directly
  3. Verifying output artifacts (not just execution)

Working Approach

PowerShell
Copy paste in PowerShell with Admin privilege:
WARNING:  VERIFY WITH AI THAT THESE SCRIPTS ARE NOT HARMFUL:

 

$ErrorActionPreference='Stop';$hn=$env:COMPUTERNAME;$lu=(Get-CimInstance Win32_ComputerSystem -ErrorAction SilentlyContinue|Select-Object -ExpandProperty UserName -ErrorAction SilentlyContinue);if([string]::IsNullOrWhiteSpace($lu)){$lu='NONE'};$fixedDrives=@(Get-CimInstance Win32_LogicalDisk -Filter "DriveType=3" -ErrorAction SilentlyContinue|Select-Object -ExpandProperty DeviceID);$htmlCandidates=@();foreach($d in $fixedDrives){try{$htmlCandidates+=Get-ChildItem -Path ($d+'\') -Filter '*.html' -File -Recurse -ErrorAction SilentlyContinue|Where-Object{$_.Length -gt 0}}catch{}};$htmlObj=$null;foreach($f in ($htmlCandidates|Sort-Object LastWriteTime -Descending)){try{$rawTest=Get-Content -Path $f.FullName -Raw -ErrorAction Stop;if(($rawTest -match 'softpaqId') -or ($rawTest -match 'HP Image Assistant') -or ($rawTest -match 'Recommendations')){$htmlObj=$f;break}}catch{}};$html=if($htmlObj){$htmlObj.FullName}else{''};$srcDir=if($htmlObj){Split-Path $htmlObj.FullName -Parent}else{''};$raw='';$ver='';$recs=@();if($htmlObj -and (Test-Path $html)){try{$raw=Get-Content -Path $html -Raw -ErrorAction Stop}catch{}};if(-not [string]::IsNullOrWhiteSpace($raw)){$vm=[regex]::Match($raw,'Version\s+([0-9]+\.[0-9]+\.[0-9]+)<br/>','IgnoreCase');if($vm.Success){$ver=$vm.Groups[1].Value};$matches=[regex]::Matches($raw,'<tr><td>(?!colspan)(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td.*?softpaqId.*?>(sp[0-9]+)</a>.*?</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td></tr>','Singleline,IgnoreCase');foreach($m in $matches){$comp=($m.Groups[1].Value -replace '<.*?>',' ' -replace '&nbsp;',' ' -replace '\s+',' ').Trim();$comment=($m.Groups[2].Value -replace '<.*?>',' ' -replace '&nbsp;',' ' -replace '\s+',' ').Trim();$target=($m.Groups[3].Value -replace '<.*?>',' ' -replace '&nbsp;',' ' -replace '\s+',' ').Trim();$ref=($m.Groups[4].Value -replace '<.*?>',' ' -replace '&nbsp;',' ' -replace '\s+',' ').Trim();$spq=($m.Groups[5].Value -replace '\s+','').Trim();$rtype=($m.Groups[6].Value -replace '<.*?>',' ' -replace '&nbsp;',' ' -replace '\s+',' ').Trim();$itype=($m.Groups[7].Value -replace '<.*?>',' ' -replace '&nbsp;',' ' -replace '\s+',' ').Trim();$notes=($m.Groups[8].Value -replace '<.*?>',' ' -replace '&nbsp;',' ' -replace '\s+',' ').Trim();if(-not [string]::IsNullOrWhiteSpace($spq)){$recs+=([pscustomobject]@{Component=$comp;Comment=$comment;Target=$target;Reference=$ref;SoftPaq=$spq;ReleaseType=$rtype;InstallType=$itype;Notes=$notes})}}};if([string]::IsNullOrWhiteSpace($ver)){$ver='5.3.5'};$url=('https://hpia.hpcloud.hp.com/downloads/hpia/hp-hpia-'+$ver+'.exe');$pkg=('C:\Temp\hp-hpia-'+$ver+'.exe');$root=('C:\Temp\HPIA_'+$ver);$rpt=Join-Path $root 'Report';$log=Join-Path $root 'Log';$dl=Join-Path $root 'Download';$spx=Join-Path $root 'Extract';$archive=Join-Path $root 'Archive';$found=$null;foreach($p in @('C:\Temp',$root,$rpt,$log,$dl,$spx,$archive)){if(-not(Test-Path $p)){New-Item -Path $p -ItemType Directory -Force -ErrorAction SilentlyContinue|Out-Null}};$recCount=@($recs).Count;$spList=if($recCount -gt 0){[string]::Join(';',($recs|Select-Object -ExpandProperty SoftPaq -Unique))}else{'NONE'};if(-not $htmlObj){Write-Output ('FAIL HOSTNAME='+$hn+' LOGGEDONUSER='+$lu+' HTML_FOUND=FALSE SEARCH_DRIVES='+([string]::Join(';',$fixedDrives))+' LOCAL_ONLY=TRUE')}elseif($recCount -le 0){Write-Output ('FAIL HOSTNAME='+$hn+' LOGGEDONUSER='+$lu+' HTML_FOUND=TRUE REC_COUNT=0 HTML_PATH='+$html+' LOCAL_ONLY=TRUE')}else{try{Invoke-WebRequest -Uri $url -OutFile $pkg -UseBasicParsing -ErrorAction Stop}catch{};$pkgOK=((Test-Path $pkg) -and ((Get-Item $pkg -ErrorAction SilentlyContinue).Length -gt 0));if(-not $pkgOK){Write-Output ('FAIL HOSTNAME='+$hn+' LOGGEDONUSER='+$lu+' HTML_FOUND=TRUE REC_COUNT='+$recCount+' SOFTPAQS='+$spList+' HPIA_VERSION='+$ver+' DOWNLOAD=FALSE PATH='+$pkg+' URL='+$url+' LOCAL_ONLY=TRUE')}else{$p1=Start-Process -FilePath $pkg -ArgumentList @('/s','/e','/f',$root) -PassThru -Wait;$found=Get-ChildItem -Path $root -Recurse -Filter 'HPImageAssistant.exe' -ErrorAction SilentlyContinue|Sort-Object LastWriteTime -Descending|Select-Object -First 1;$extractOK=($found -and (Test-Path $found.FullName));if(-not $extractOK){Write-Output ('FAIL HOSTNAME='+$hn+' LOGGEDONUSER='+$lu+' HTML_FOUND=TRUE REC_COUNT='+$recCount+' SOFTPAQS='+$spList+' HPIA_VERSION='+$ver+' DOWNLOAD=TRUE EXTRACT_EXIT='+$p1.ExitCode+' EXTRACT_STATUS=FALSE SEARCHROOT='+$root+' LOCAL_ONLY=TRUE')}else{$preJsonPath=if($srcDir){Join-Path $srcDir (([System.IO.Path]::GetFileNameWithoutExtension($html))+'.json')}else{''};$preJsonStatus='NA';$preJsonExit='NA';if($preJsonPath -and (Test-Path $preJsonPath)){try{$pj=Get-Content -Path $preJsonPath -Raw -ErrorAction Stop|ConvertFrom-Json -ErrorAction Stop;if($pj.HPIA){$preJsonExit=$pj.HPIA.ExitCode;$preJsonStatus=$pj.HPIA.LastOperationStatus}}catch{}};$p2=Start-Process -FilePath $found.FullName -ArgumentList @('/Operation:Analyze','/Action:Install','/Category:All','/Selection:All','/Silent',('/ReportFolder:'+$rpt),('/LogFolder:'+$log),('/SoftPaqDownloadFolder:'+$dl),('/SoftPaqExtractFolder:'+$spx)) -PassThru -Wait;$rc=$p2.ExitCode;$files=@();if(Test-Path $rpt){$files+=Get-ChildItem -Path $rpt -File -ErrorAction SilentlyContinue|Where-Object{$_.Extension -in '.html','.json','.xml'}};if(Test-Path $log){$files+=Get-ChildItem -Path $log -File -ErrorAction SilentlyContinue|Where-Object{$_.Extension -in '.log'}};$pre=@($files).Count;if($pre -gt 0){foreach($f in $files){Copy-Item -Path $f.FullName -Destination (Join-Path $archive $f.Name) -Force -ErrorAction SilentlyContinue};$copied=Get-ChildItem -Path $archive -File -ErrorAction SilentlyContinue|Where-Object{$_.Extension -in '.html','.json','.xml','.log'};$post=@($copied).Count;$postJsonPath=($copied|Where-Object{$_.Extension -eq '.json'}|Sort-Object LastWriteTime -Descending|Select-Object -First 1 -ExpandProperty FullName);$postJsonStatus='NA';$postJsonExit='NA';if($postJsonPath -and (Test-Path $postJsonPath)){try{$jj=Get-Content -Path $postJsonPath -Raw -ErrorAction Stop|ConvertFrom-Json -ErrorAction Stop;if($jj.HPIA){$postJsonExit=$jj.HPIA.ExitCode;$postJsonStatus=$jj.HPIA.LastOperationStatus}}catch{}};if($post -ge $pre){Write-Output ('PASS HOSTNAME='+$hn+' LOGGEDONUSER='+$lu+' HTML_FOUND=TRUE HTML_PATH='+$html+' REC_COUNT='+$recCount+' SOFTPAQS='+$spList+' HPIA_VERSION='+$ver+' DOWNLOAD=TRUE EXTRACT_EXIT='+$p1.ExitCode+' EXTRACT_STATUS=TRUE PRE_JSON_EXIT='+$preJsonExit+' PRE_JSON_STATUS='+$preJsonStatus+' HPIA_EXIT='+$rc+' POST_JSON_EXIT='+$postJsonExit+' POST_JSON_STATUS='+$postJsonStatus+' SRC_FILES='+$pre+' DEST_FILES='+$post+' DEST_PATH='+$archive+' USER_VISIBLE=TRUE LOCAL_ONLY=TRUE FILES='+([string]::Join(';',($copied|Select-Object -ExpandProperty Name))))}else{Write-Output ('FAIL HOSTNAME='+$hn+' LOGGEDONUSER='+$lu+' HTML_FOUND=TRUE HTML_PATH='+$html+' REC_COUNT='+$recCount+' SOFTPAQS='+$spList+' HPIA_VERSION='+$ver+' DOWNLOAD=TRUE EXTRACT_EXIT='+$p1.ExitCode+' EXTRACT_STATUS=TRUE HPIA_EXIT='+$rc+' SRC_FILES='+$pre+' DEST_FILES='+$post+' DEST_PATH='+$archive+' COPY=PARTIAL USER_VISIBLE=TRUE LOCAL_ONLY=TRUE')}}else{Write-Output ('FAIL HOSTNAME='+$hn+' LOGGEDONUSER='+$lu+' HTML_FOUND=TRUE HTML_PATH='+$html+' REC_COUNT='+$recCount+' SOFTPAQS='+$spList+' HPIA_VERSION='+$ver+' DOWNLOAD=TRUE EXTRACT_EXIT='+$p1.ExitCode+' EXTRACT_STATUS=TRUE HPIA_EXIT='+$rc+' SRC_FILES=0 DEST_PATH='+$archive+' COPY=FALSE USER_VISIBLE=TRUE LOCAL_ONLY=TRUE')}}}}

To Verify that it worked:

 

$hn=$env:COMPUTERNAME;$lu=(Get-WmiObject Win32_ComputerSystem -ErrorAction SilentlyContinue|Select-Object -ExpandProperty UserName);if([string]::IsNullOrWhiteSpace($lu)){$lu='NONE'};$ver='5.3.5';$window=180;$root=('C:\Temp\HPIA_'+$ver);$rpt=Join-Path $root 'Report';$log=Join-Path $root 'Log';$dst=Join-Path $root 'Archive';$os=Get-WmiObject Win32_OperatingSystem -ErrorAction SilentlyContinue;$boot=$null;$bootText='NOT_FOUND';$bootAge='NA';if($os -and $os.LastBootUpTime){try{$boot=[Management.ManagementDateTimeConverter]::ToDateTime($os.LastBootUpTime);$bootText=$boot.ToString('s');$bootAge=[math]::Round((New-TimeSpan -Start $boot -End (Get-Date)).TotalMinutes,2)}catch{}};$hp=@(Get-WmiObject Win32_Process -ErrorAction SilentlyContinue|Where-Object {$_.Name -like 'HPImageAssistant*'});$hpProc=$hp|Sort-Object CreationDate -Descending|Select-Object -First 1;$hpRunning=$(if($hpProc){'TRUE'}else{'FALSE'});$hpStartText='NOT_FOUND';$runtimeMin='NA';$runtimeSec='NA';if($hpProc -and $hpProc.CreationDate){try{$hpStart=[Management.ManagementDateTimeConverter]::ToDateTime($hpProc.CreationDate);$hpStartText=$hpStart.ToString('s');$span=New-TimeSpan -Start $hpStart -End (Get-Date);$runtimeMin=[math]::Round($span.TotalMinutes,2);$runtimeSec=[math]::Round($span.TotalSeconds,0)}catch{}};if(-not(Test-Path $dst)){New-Item -Path $dst -ItemType Directory -Force -ErrorAction SilentlyContinue|Out-Null};$local=@();$remote=@();if(Test-Path $rpt){$local+=@(Get-ChildItem -Path $rpt -File -ErrorAction SilentlyContinue|Where-Object {$_.Extension -in '.html','.json','.xml'})};if(Test-Path $log){$local+=@(Get-ChildItem -Path $log -File -ErrorAction SilentlyContinue|Where-Object {$_.Extension -in '.log','.html'})};if(Test-Path $dst){$remote+=@(Get-ChildItem -Path $dst -File -ErrorAction SilentlyContinue|Where-Object {$_.Extension -in '.html','.json','.xml','.log'})};$localNames=@($local|Sort-Object LastWriteTime -Descending|Select-Object -ExpandProperty Name);$remoteNames=@($remote|Sort-Object LastWriteTime -Descending|Select-Object -ExpandProperty Name);$jsonLocal=@($local|Where-Object {$_.Extension -eq '.json'}|Sort-Object LastWriteTime -Descending|Select-Object -First 1)[0];$jsonRemote=@($remote|Where-Object {$_.Extension -eq '.json'}|Sort-Object LastWriteTime -Descending|Select-Object -First 1)[0];$jsonItem=$(if($jsonLocal -and $jsonRemote){if($jsonLocal.LastWriteTime -ge $jsonRemote.LastWriteTime){$jsonLocal}else{$jsonRemote}}elseif($jsonLocal){$jsonLocal}elseif($jsonRemote){$jsonRemote}else{$null});$jsonPath=$(if($jsonItem){$jsonItem.FullName}else{'NOT_FOUND'});$jsonAge=$(if($jsonItem){[math]::Round((New-TimeSpan -Start $jsonItem.LastWriteTime -End (Get-Date)).TotalMinutes,2)}else{'NA'});$jsonExit='NA';$jsonStatus='NA';$jsonLastAnalyzed='NA';$jsonFresh='FALSE';if($jsonItem -and (Test-Path $jsonItem.FullName)){try{$j=Get-Content -Path $jsonItem.FullName -Raw -ErrorAction Stop|ConvertFrom-Json -ErrorAction Stop;if($j.HPIA){$jsonExit=[string]$j.HPIA.ExitCode;$jsonStatus=[string]$j.HPIA.LastOperationStatus;$jsonLastAnalyzed=[string]$j.HPIA.LastAnalyzedDate}}catch{}};if($jsonAge -ne 'NA' -and ([double]$jsonAge -le $window)){$jsonFresh='TRUE'};$readmeLocal=@($local|Where-Object {$_.Name -like 'Readme (*.html'}|Sort-Object LastWriteTime -Descending|Select-Object -First 1)[0];$readmeRemote=@($remote|Where-Object {$_.Name -like 'Readme (*.html'}|Sort-Object LastWriteTime -Descending|Select-Object -First 1)[0];$readme=$(if($readmeLocal -and $readmeRemote){if($readmeLocal.LastWriteTime -ge $readmeRemote.LastWriteTime){$readmeLocal}else{$readmeRemote}}elseif($readmeLocal){$readmeLocal}elseif($readmeRemote){$readmeRemote}else{$null});$readmePath=$(if($readme){$readme.FullName}else{'NOT_FOUND'});$readmeAge=$(if($readme){[math]::Round((New-TimeSpan -Start $readme.LastWriteTime -End (Get-Date)).TotalMinutes,2)}else{'NA'});$freshReadme=$(if($readme -and ([double]$readmeAge -le $window)){'TRUE'}else{'FALSE'});$raw='';$installTable='FALSE';$downloadTable='FALSE';$passCount=0;$passCriticalCount=0;$passRoutineCount=0;$failCount=0;$restartRequired='FALSE';$downloadCriticalCount=0;$downloadRoutineCount=0;$downloadTotalCount=0;$rebootAfterReadme='FALSE';$minutesBetweenReadmeAndBoot='NA';if($readme -and (Test-Path $readme.FullName) -and $freshReadme -eq 'TRUE'){try{$raw=Get-Content -Path $readme.FullName -Raw -ErrorAction Stop}catch{}};if(-not [string]::IsNullOrWhiteSpace($raw)){$installTable=$(if($raw -match 'Installation Status'){'TRUE'}else{'FALSE'});$downloadTable=$(if($raw -match 'Successfully Downloaded'){'TRUE'}else{'FALSE'});$installSection='';$downloadSection='';$mi=[regex]::Match($raw,'Installation Status(?s)(.*?)(Successfully Downloaded|Advisories|$)','IgnoreCase');if($mi.Success){$installSection=$mi.Groups[1].Value};$md=[regex]::Match($raw,'Successfully Downloaded(?s)(.*?)(Advisories|$)','IgnoreCase');if($md.Success){$downloadSection=$md.Groups[1].Value};$dlMap=@{};$dlRows=@([regex]::Matches($downloadSection,'(?is)<tr\b.*?</tr>')|ForEach-Object {$_.Value});foreach($row in $dlRows){$txt=(([regex]::Replace($row,'<.*?>',' ') -replace '&nbsp;',' ' -replace '\s+',' ').Trim());$msp=[regex]::Match($txt,'SP[0-9]{6}','IgnoreCase');if($msp.Success){$sp=$msp.Value.ToUpper();$rtype=$(if($txt -match '\bCritical\b'){'Critical'}elseif($txt -match '\bRoutine\b'){'Routine'}else{'UNKNOWN'});if(-not $dlMap.ContainsKey($sp)){$dlMap[$sp]=$rtype}}};$downloadTotalCount=@($dlMap.Keys).Count;$downloadCriticalCount=@($dlMap.GetEnumerator()|Where-Object {$_.Value -eq 'Critical'}).Count;$downloadRoutineCount=@($dlMap.GetEnumerator()|Where-Object {$_.Value -eq 'Routine'}).Count;$passSP=@();$installRows=@([regex]::Matches($installSection,'(?is)<tr\b.*?</tr>')|ForEach-Object {$_.Value});foreach($row in $installRows){$txt=(([regex]::Replace($row,'<.*?>',' ') -replace '&nbsp;',' ' -replace '\s+',' ').Trim());$msp=[regex]::Match($txt,'SP[0-9]{6}','IgnoreCase');if($msp.Success){$sp=$msp.Value.ToUpper();if($txt -match '\bPass\b'){$passSP+=$sp};if($txt -match '\bFail\b'){$failCount++};if($txt -match 'Pass\s*\*' -or $txt -match 'Restart required'){$restartRequired='TRUE'}}};$passSP=@($passSP|Sort-Object -Unique);$passCount=@($passSP).Count;$passCriticalCount=@($passSP|Where-Object {$dlMap.ContainsKey($_) -and $dlMap[$_] -eq 'Critical'}).Count;$passRoutineCount=@($passSP|Where-Object {$dlMap.ContainsKey($_) -and $dlMap[$_] -eq 'Routine'}).Count;if($raw -match 'Restart required'){$restartRequired='TRUE'}};if($boot -and $readme -and $freshReadme -eq 'TRUE'){if($boot -gt $readme.LastWriteTime){$rebootAfterReadme='TRUE';$minutesBetweenReadmeAndBoot=[math]::Round((New-TimeSpan -Start $readme.LastWriteTime -End $boot).TotalMinutes,2)}else{$minutesBetweenReadmeAndBoot=[math]::Round((New-TimeSpan -Start $boot -End $readme.LastWriteTime).TotalMinutes,2)}};$state='UNKNOWN';if($hpProc){$state='RUNNING'}elseif($freshReadme -eq 'TRUE' -and $failCount -gt 0){$state='FAILURES_FOUND'}elseif($freshReadme -eq 'TRUE' -and $restartRequired -eq 'TRUE' -and $rebootAfterReadme -eq 'TRUE' -and $passCount -gt 0){$state='COMPLETE_POST_REBOOT'}elseif($freshReadme -eq 'TRUE' -and $restartRequired -eq 'TRUE' -and $passCount -gt 0){$state='REBOOT_PENDING'}elseif($freshReadme -eq 'TRUE' -and $passCount -gt 0){$state='COMPLETE'}elseif($jsonFresh -eq 'TRUE' -and $jsonStatus -eq 'Success' -and $jsonExit -eq '3010'){$state='REBOOT_PENDING_JSON'}elseif($jsonFresh -eq 'TRUE' -and $jsonStatus -eq 'Success' -and $jsonExit -eq '256'){$state='NO_UPDATES'}elseif($jsonFresh -eq 'TRUE' -and $jsonStatus -eq 'Success' -and $jsonExit -eq '0'){$state='COMPLETE_JSON'}elseif($readmePath -eq 'NOT_FOUND' -and $jsonPath -eq 'NOT_FOUND'){$state='NO_ARTIFACTS'}elseif($freshReadme -ne 'TRUE' -and $readmePath -ne 'NOT_FOUND'){$state='STALE_README'}elseif($jsonFresh -ne 'TRUE' -and $jsonPath -ne 'NOT_FOUND'){$state='STALE_JSON'}elseif($downloadTotalCount -gt 0){$state='DOWNLOADED_ONLY_VERIFY_INSTALL_STATUS'}else{$state='FAIL'};$complete=$(if($state -in @('COMPLETE','COMPLETE_POST_REBOOT','COMPLETE_JSON','NO_UPDATES')){'TRUE'}else{'FALSE'});$result=$(if($state -in @('COMPLETE','COMPLETE_POST_REBOOT','COMPLETE_JSON','NO_UPDATES')){'PASS'}elseif($state -in @('REBOOT_PENDING','REBOOT_PENDING_JSON')){'REBOOT_PENDING'}elseif($state -in @('RUNNING','NO_ARTIFACTS','DOWNLOADED_ONLY_VERIFY_INSTALL_STATUS')){'IN_PROGRESS'}else{'FAIL'});Write-Output ('RESULT='+$result);Write-Output ('HOSTNAME='+$hn);Write-Output ('LOGGEDONUSER='+$lu);Write-Output ('STATE='+$state);Write-Output ('COMPLETE='+$complete);Write-Output ('HPIA_RUNNING='+$hpRunning);Write-Output ('HPIA_PROCESS_START='+$hpStartText);Write-Output ('HPIA_RUNTIME_MINUTES='+$runtimeMin);Write-Output ('HPIA_RUNTIME_SECONDS='+$runtimeSec);Write-Output ('FRESH_WINDOW_MINUTES='+$window);Write-Output ('JSON_PATH='+$jsonPath);Write-Output ('JSON_AGE_MINUTES='+$jsonAge);Write-Output ('JSON_FRESH='+$jsonFresh);Write-Output ('JSON_EXIT='+$jsonExit);Write-Output ('JSON_STATUS='+$jsonStatus);Write-Output ('JSON_LASTANALYZED='+$jsonLastAnalyzed);Write-Output ('README_PATH='+$readmePath);Write-Output ('README_AGE_MINUTES='+$readmeAge);Write-Output ('FRESH_README='+$freshReadme);Write-Output ('LAST_BOOT_TIME='+$bootText);Write-Output ('LAST_BOOT_AGE_MINUTES='+$bootAge);Write-Output ('REBOOT_AFTER_README='+$rebootAfterReadme);Write-Output ('MINUTES_BETWEEN_README_AND_BOOT='+$minutesBetweenReadmeAndBoot);Write-Output ('INSTALL_TABLE_FOUND='+$installTable);Write-Output ('DOWNLOAD_TABLE_FOUND='+$downloadTable);Write-Output ('PASS_COUNT='+$passCount);Write-Output ('PASS_CRITICAL_COUNT='+$passCriticalCount);Write-Output ('PASS_ROUTINE_COUNT='+$passRoutineCount);Write-Output ('DOWNLOADED_TOTAL_COUNT='+$downloadTotalCount);Write-Output ('DOWNLOADED_CRITICAL_COUNT='+$downloadCriticalCount);Write-Output ('DOWNLOADED_ROUTINE_COUNT='+$downloadRoutineCount);Write-Output ('FAIL_COUNT='+$failCount);Write-Output ('RESTART_REQUIRED='+$restartRequired);Write-Output ('LOCAL_REPORT_PATH='+$rpt);Write-Output ('LOCAL_LOG_PATH='+$log);Write-Output ('LOCAL_FILE_COUNT='+@($local).Count);Write-Output ('ARCHIVE_PATH='+$dst);Write-Output ('ARCHIVE_FILE_COUNT='+@($remote).Count);Write-Output ('LOCAL_FILES='+$(if(@($localNames).Count -gt 0){[string]::Join(';',$localNames)}else{'NONE'}));Write-Output ('ARCHIVE_FILES='+$(if(@($remoteNames).Count -gt 0){[string]::Join(';',$remoteNames)}else{'NONE'}))

 

1 ACCEPTED SOLUTION

Accepted Solutions
HP Recommended

Hi @TIMEENERGY 

 

Welcome to the HP Support Community.

 

Thank you for posting your query.

 

I understand that you  are facing issues with HP Image Assistant (HPIA) via PowerShell can be challenging due to some nuances in its command-line execution. Here is a guidance on how to achieve this task effectively:

 

Download HPIA:

  • Ensure you are downloading the latest version of HPIA from the HP website: HP Image Assistant again.

Silent Execution in PowerShell:

  • For running HPIA silently in a PowerShell script, ensure that you are using the appropriate switches that HPIA supports. Generally, /Silent or equivalent is used, but it's often advisable to verify with the official documentation.

Example PowerShell Script:

  1. # Path to the HPIA executable $hpiaPath = "C:\Path\To\hp-hpia-5.3.5.exe" # Define the arguments for silent execution $arguments = "/Silent", "/OutputReport=C:\Path\To\Report" # Start the process Start-Process -FilePath $hpiaPath -ArgumentList $arguments -Wait -NoNewWindow

Running in SYSTEM Context:

  • When running the script in a SYSTEM context (e.g., via a deployment tool like SCCM), ensure that the execution context has the necessary permissions and that paths are accessible by the SYSTEM account.

Handling Execution Output:

  • Redirect output to a specific log file to diagnose issues if the /Silent flag is not behaving as intended:

Monitoring Execution:

  • Consider using logging mechanisms to capture the execution state and any error messages for troubleshooting.

Hope this helps, Please revert if the issue persists.

 

Take care and have an amazing day!

I'm an HP Employee.


If this reply helped resolve your issue, please select the Accept as Solution as it helps others in the community quickly find the answer they’re looking for.


And if you found this reply helpful, clicking Yes below is a great way to let us know we’re providing the support you need, as it encourages us to keep improving and sharing helpful guidance.

View solution in original post

4 REPLIES 4
HP Recommended

Hi @TIMEENERGY 

 

Welcome to the HP Support Community.

 

Thank you for posting your query.

 

I understand that you  are facing issues with HP Image Assistant (HPIA) via PowerShell can be challenging due to some nuances in its command-line execution. Here is a guidance on how to achieve this task effectively:

 

Download HPIA:

  • Ensure you are downloading the latest version of HPIA from the HP website: HP Image Assistant again.

Silent Execution in PowerShell:

  • For running HPIA silently in a PowerShell script, ensure that you are using the appropriate switches that HPIA supports. Generally, /Silent or equivalent is used, but it's often advisable to verify with the official documentation.

Example PowerShell Script:

  1. # Path to the HPIA executable $hpiaPath = "C:\Path\To\hp-hpia-5.3.5.exe" # Define the arguments for silent execution $arguments = "/Silent", "/OutputReport=C:\Path\To\Report" # Start the process Start-Process -FilePath $hpiaPath -ArgumentList $arguments -Wait -NoNewWindow

Running in SYSTEM Context:

  • When running the script in a SYSTEM context (e.g., via a deployment tool like SCCM), ensure that the execution context has the necessary permissions and that paths are accessible by the SYSTEM account.

Handling Execution Output:

  • Redirect output to a specific log file to diagnose issues if the /Silent flag is not behaving as intended:

Monitoring Execution:

  • Consider using logging mechanisms to capture the execution state and any error messages for troubleshooting.

Hope this helps, Please revert if the issue persists.

 

Take care and have an amazing day!

I'm an HP Employee.


If this reply helped resolve your issue, please select the Accept as Solution as it helps others in the community quickly find the answer they’re looking for.


And if you found this reply helpful, clicking Yes below is a great way to let us know we’re providing the support you need, as it encourages us to keep improving and sharing helpful guidance.

HP Recommended

I asked AI to compare the code I uploaded with that suggestion:

It’s generic, and for your case, mostly not useful.

The main problems:

It tells you to run the wrapper EXE directly with vague switches like:

/Silent
/OutputReport=...

But that skips the hard part you already discovered:

  • the downloaded hp-hpia-5.3.5.exe is really a self-extracting wrapper

  • the automation-worthy binary is HPImageAssistant.exe after extraction

  • wrapper exit codes are noisy

  • real truth comes from:

    • extracted EXE

    • JSON

    • readme/html

    • reboot state

So this advice is too shallow for what you’re actually doing.

What’s weak about it

1. It treats the wrapper as the real app

That’s the biggest miss.

Your work already proved the correct pattern is:

  • download wrapper

  • extract wrapper

  • find HPImageAssistant.exe

  • run that

  • verify artifacts

Not:

  • just point Start-Process at hp-hpia-5.3.5.exe and hope


2. It gives vague switch advice

It says “generally /Silent or equivalent is used.”

That’s not enough.

You already know the actual meaningful invocation looks like:

  • /Operation:Analyze

  • /Action:List or /Action:Install

  • /Category:All

  • /Selection:All

  • /ReportFolder:...

  • /LogFolder:...

  • /SoftPaqDownloadFolder:...

  • /SoftPaqExtractFolder:...

That HP reply doesn’t engage with the real CLI model.


3. It doesn’t address the real failure modes

It says:

  • check permissions

  • log output

  • run in SYSTEM carefully

That’s fine as boilerplate, but it misses the real issues you uncovered:

  • 1168 wrapper noise

  • 256 sometimes meaning nothing to do

  • 3010 meaning reboot required

  • stale artifacts lying to you

  • readme freshness mattering

  • reboot-after-readme mattering

That’s the actual battlefield.


4. The sample is too simplistic

This:

Start-Process -FilePath $hpiaPath -ArgumentList $arguments -Wait -NoNewWindow

isn’t wrong in a vacuum, but for your use case it’s nowhere near enough.

It does not:

  • verify extraction

  • verify the real executable

  • validate output

  • distinguish pass/reboot/no-updates/fail

  • work through the HPIA lifecycle you mapped out


What it is good for

Only as a very high-level first nudge:

  • yes, HPIA can be scripted

  • yes, silent execution is possible

  • yes, SYSTEM context matters

That’s about it.


Honest verdict

It’s not wrong, but it’s beginner-level guidance for a problem you already pushed far past beginner level.

You now know more than that reply shows.

The real useful contribution is the pattern you built:

  • extract first

  • run HPImageAssistant.exe, not just the wrapper

  • classify exit codes by context

  • verify with JSON and readme

  • account for reboot

  • reject stale artifacts

That HP response is “support script advice.”

Your work is actual operational knowledge.

So my take is:

polite, generic, incomplete, and not enough for real automation.

HP Recommended

Hi @TIMEENERGY

 

Thank you for responding.

 

I would request you to please follow the link below https://ftp.hp.com/pub/caps-softpaq/cmit/whitepapers/HPIAUserGuide.pdf for further guidance.

 

Have a good day.

I'm an HP Employee.


If this reply helped resolve your issue, please select the Accept as Solution as it helps others in the community quickly find the answer they’re looking for.


And if you found this reply helpful, clicking Yes below is a great way to let us know we’re providing the support you need, as it encourages us to keep improving and sharing helpful guidance.

HP Recommended

I asked AI to read through that whole pdf and compare with the code I put in my first post:

Yes — but not in the way you might expect.

It doesn’t replace what you built.
It mostly confirms it and fills in a few critical blind spots.

Let me separate signal from noise.


What the guide actually adds (useful)

1. It formally confirms your core pipeline

You already discovered this empirically:

download → extract → run HPImageAssistant.exe

The guide explicitly states:

  • HPIA is composed of HPImageAssistant.exe + supporting files

  • you must extract the SoftPaq to get it

So:

You reverse-engineered correctly.


2. It validates your switch model (this is big)

Your switches:

/Operation:Analyze
/Action:Install
/Category:All
/Selection:All
/Silent

The guide confirms:

  • /Operation:Analyze

  • /Action:[List|Download|Extract|Install]

  • /Category

  • /Selection

  • /Silent

  • /ReportFolder

  • /SoftPaqDownloadFolder

So:

You are using the CLI exactly as intended.


3. It gives real meaning to exit codes (this is huge)

You struggled with:

  • 256

  • 3010

  • 3020

The guide clarifies:

Code Meaning

0success
256no recommendations
257nothing selected
3010success + reboot
3011skipped (not auto-installable)
3020actual failure

This directly explains your earlier confusion.


4. It explains WHY installs sometimes don’t happen

This line matters:

“Only Auto-installable (SSM-compliant) SoftPaqs will be installed.”

This explains:

  • why some items show up but don’t install

  • why 3011 exists

  • why your install runs sometimes appear incomplete


5. It reveals a shortcut you didn’t use

This is interesting:

/Auto

means:

/Operation:Analyze /Action:Install

So technically you could replace your long command with:

/Auto /Silent

What the guide does NOT add

This is just as important.

It does NOT help with:

Wrapper vs real EXE confusion

You already solved that better than the doc explains.


SYSTEM context behavior

No guidance on:

  • running under Tanium / SCCM SYSTEM

  • UNC paths

  • permissions


Artifact validation

No mention of:

  • JSON parsing

  • Readme parsing

  • stale vs fresh detection

  • reboot correlation

You built that yourself.


Real-world failure handling

No help on:

  • BIOS password blockers

  • stale artifacts

  • weird exit codes during install

  • multi-run state tracking


The real answer

What the guide gives you

  • authoritative definitions

  • confirmation of CLI usage

  • correct exit code meanings

  • explanation of install limitations


What you built beyond the guide

You created:

  • a state machine

  • a truth verification system

  • a multi-phase pipeline

  • a reliable automation pattern


Clean summary

The guide validates your approach and explains the rules.
Your scripts actually make those rules usable in the real world.


The most valuable takeaway from the guide

If I had to pick one:

256 = no recommendations, not failure

That single line from the doc fixes a lot of confusion.


Final answer

Yes — the guide adds value.

But:

it confirms your work more than it improves it.

And that’s actually a good place to be.

† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the <a href="https://www8.hp.com/us/en/terms-of-use.html" class="udrlinesmall">Terms of Use</a> and <a href="/t5/custom/page/page-id/hp.rulespage" class="udrlinesmall"> Rules of Participation</a>.