$PathIntune = "$Env:Programfiles\Intune"

$PackageName = "Printer"
$PrinterName = "Xerox Versalink C7025 - Vznohradská"

Start-Transcript -Path "$PathIntune\Log\$PackageName-install.log" -Force

Try {
    $PrinterExist = Get-Printer -Name $PrinterName -ErrorAction SilentlyContinue
    if ($PrinterExist) {
        Remove-Printer -Name $PrinterName -Confirm:$false
    }
}
Catch {
    Write-Warning "Error removing Printer"
    Write-Warning "$($_.Exception.Message)"
}
0

Stop-Transcript