Powershell hard crash on PIA event trigger

56 Views Asked by At

Seeing a weird problem with powershell, here's the code:

[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.PowerPoint")
$ppt = New-Object Microsoft.Office.Interop.PowerPoint.ApplicationClass
Register-ObjectEvent -InputObject $ppt -EventName "PresentationBeforeSave" -SourceIdentifier "LBPPTBeforeSave" -Action { Write-Host "here" }

I'm hooking into PresentationBeforeSave in PowerPoint. This registers fine, but when I hit save in Powerpoint ISE completely crashes. In event viewer I see bad stuff, exit code 80131506 and 0xc0000005.

I can hook SlideSelectionChanged just fine though. So I'm wondering if this has something to do with the Cancel out variable that PresentationBeforeSave exposes? Any advice would be appreciated.

0

There are 0 best solutions below