Have you thought about using the RCMD service on the remote computer?
Using RCMD would let you execute a local shutdown/logout command.

It would be possible to code those WMI interfaces in the link/VB script that JensKalski has posted......hmmm a challenge!!!

Bryce