vesuvius said:

That is because the code sample you have supplied is using WPF commands (or the command design pattern) and not events, so you need to look up how to handle commanding in Powershell or change the button command into events

Hmm. Ribbon UI is using custom commands and and not the normal commands wpf goes by.