error

suggest change
Get-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).

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents