I am running the following script and receiving the following POP UP to select printer, how can I handle it? Disable it or click OK
[1
param(
[string]$filepath
)
$fileitem = Get-Item $filepath
try {
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false
$wb = $excel.Workbooks.Open($fileitem.FullName)
# Generate path of save destination PDF file
$pdfpath = $fileitem.DirectoryName + "\" + $fileitem.BaseName + ".pdf"
# Save as PDF
$wb.ExportAsFixedFormat([Microsoft.Office.Interop.Excel.XlFixedFormatType]::xlTypePDF, $pdfpath)
$wb.Close()
$excel.Quit()
}