Simulate CTRL+F12 2 second keypress
Rather than simulating a keyboard shortcut, you can simply call the shutdown dialog itself with the following AppleScript:

tell application "loginwindow" to «event aevtrsdn»


…or for the restart dialog:

tell application "loginwindow" to «event aevtrrst»