error
suggest changeGet-Process -Name doesnotexist
Write-Host -Object ('The last error that occurred was: {0}' -f $error[0].Exception.Message)
$Error is an array of the most recent error objects. The newest one is $Error[0].
To keep an error out of $Error, use -ErrorAction Ignore. That value was added in Windows PowerShell 3.0. See about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents