Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Close an application gracefully?

$
0
0

I found this code:

Get-Process Outlook |  Foreach-Object { $_.CloseMainWindow() | Out-Null }  

I ran this and it closed Outlook.   My question is this:  is $_.CloseMainWindow() truly the graceful way to close an application?  Meaning is it the same as clicking File-Close from within the app?

I'm dealing with Outlook and PST files (again) and it has been pointed out if you use stop-process -force it can cause .PST file corruption.  

Thank you.  

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles