다음을 통해 공유


PowerShell Troubleshooting: Using COM Objects

Code Used

Add-Type -AssemblyName 'Microsoft.Office.Interop.Outlook'
$Outlook = New-Object -ComObject 'Outlook.Application'

Reason

The code is correct, no issues identified. The reason is OUTLOOK process is already running in your system.

Fix

Exit Outlook

Get-Process -Name OUTLOOK | Stop-Process -ErrorAction SilentlyContinue
Add-Type -AssemblyName 'Microsoft.Office.Interop.Outlook'
$Outlook = New-Object -ComObject 'Outlook.Application'

Error Message

Enjoy PowerShell :)