PowerTip: Release COM Object in PowerShell

Doctor Scripto

Summary: Learn how to release a COM object in Windows PowerShell. 

  How can I make sure that a COM object in my Windows PowerShell automation script releases?

  Use the ReleaseCOMObject static method from the Marshal class, and then pass it to the variable
           that holds the COM object, for example:

[System.Runtime.Interopservices.Marshal]::ReleaseComObject($doc) | Out-Null

0 comments

Discussion is closed.

Feedback usabilla icon