Put a computer in hibernate sleep shutdown standby, etc modes

Well, the declare should work. But it could be that system blocks your request due to permissions.

The plugin function does the same except it first checks permissions and asks Windows to actually permit the application to logout/shutdown.