How to Use Intune to Use HP Image Assist to download and update Drivers

#Detect
#Make sure you download and insstall hp-hpia-5.3.0.exe
$HPIA_folder = "C:\SWSetup\SP154530"
$HPIA_reco = "$HPIA_folder\Recommendations"
$HPIA_exe = "$HPIA_folder\HPImageAssistant.exe"
$HPIA_category = "Drivers,Firmware" 

Try {
    if([System.IO.File]::Exists($HPIA_exe)){
        if(Test-Path $HPIA_reco){Remove-Item $HPIA_reco -Recurse -Force}
        Start-Process $HPIA_exe -ArgumentList "/Operation:Analyze /Category:$HPIA_category /Action:List /Silent /ReportFolder:""$HPIA_reco""" -Wait
        $HPIA_analyze = Get-Content "$HPIA_reco\*.json" | ConvertFrom-Json

        if($HPIA_analyze.HPIA.Recommendations.count -lt 1){
            Write-Output "Compliant, no drivers needed"
            Exit 0
        }else{
            Write-Warning "Found drivers to download/install: $($HPIA_analyze.HPIA.Recommendations)"
            Exit 1
        }
        
        
    }else{
        Write-Error "HP Image Assistant missing"
        Exit 1
    }
} 
Catch {
    Write-Error $_.Exception
    Exit 1
}

#remmediate
$HPIA_folder = "C:\SWSetup\SP154530"
$HPIA_report = "$HPIA_folder\Report"
$HPIA_exe = "$HPIA_folder\HPImageAssistant.exe"
$HPIA_category = "Drivers,Firmware"

try{
    Start-Process $HPIA_exe -ArgumentList "/Operation:Analyze /Action:Install /Category:$HPIA_category /Silent /AutoCleanup /reportFolder:""$HPIA_report""" -Wait 
    $HPIA_analyze = Get-Content "$HPIA_report\*.json" | ConvertFrom-Json
    Write-Output "Installation completed: $($HPIA_analyze.HPIA.Recommendations)"
}catch{
    Write-Error $_.Exception
}

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...