$LastExitCode has to do with the exit code of Win32 applications, not PowerShell cmdlets. You might be better to check $? for True or False. The $? variable can report on both Win32 applications and PowerShell cmdlets. Here's the text from Get-Help about_Automatic_Variables:
$?
Contains the execution status of the last operation. It contains
TRUE if the last operation succeeded and FALSE if it failed.
You could also clear $Error, such as $Error.Clear() and then check the value of $Error[0] to see if it is populated or not after your command has run.