In Monterey I've been using the AppleScript from AppleScript to automate switching user not working in Monterey to switch from my regular account to the admin account.
tell application "System Events"
tell application process "Control Center"
click (first menu bar item of menu bar 1 ¬
whose value of attribute "AXIdentifier" is "com.apple.menuextra.user")
click (first button of window "Control Center" whose name is "Administrator")
end tell
end tell
Today I upgraded to Ventura and it stopped working. The error it gets is:
System Events got an error: Can’t get button 1 of window "Control Center" of application process "Control Center" whose name = "Administrator". Invalid index.