PowerTip: Release COM Object in PowerShell

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

Comments (0)

Skip to main content