Created
December 13, 2018 10:12
-
-
Save whtsky/b0a71c1114636618a9d39c3a6aee947d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem -Path 'D:\PATH' -Filter *pptx -Recurse | | |
ForEach-Object -Begin { | |
$null = Add-Type -AssemblyName Microsoft.Office.Interop.powerpoint | |
$SaveOption = [Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType]::ppSaveAsPDF | |
$PowerPoint = New-Object -ComObject "PowerPoint.Application" | |
} -Process { | |
$Presentation = $PowerPoint.Presentations.Open($_.FullName) | |
$PdfNewName = $_.FullName -replace '\.pptx$','.pdf' | |
$presentation.SaveAs($PdfNewName,$SaveOption) | |
$presentation.close() | |
} -end{ | |
$powerpoint.quit() | |
Stop-Process -name POWERPNT -Force | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment