It seems that some IT departments like to lock out the fast user switching option on company laptops in a lot of companies at the moment. This became a problem for me as I have a local admin account on my work machine, and I have to switch to it whenever I want to install from a dmg file. This got me thinking, is there a command line argument or tool that I could run to do this? Sure enough there is. The only thing you need to look up is the UserId for the user that you want to switch to.
To get the UserId you need to use dscl as follows:
dscl . -read /Users/[username] UniqueID
Then you can use the following command to switch user:
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID [UniqueID]
For my work machine I have put this command into a shell script within my ~/bin directory. This means that I can quickly switch to my local admin without remembering this command, so I’ve no idea why people would turn of the UI to Fast User switch.