Add-SPShellAdmin Complicated by $-accounts
When adding a new admin user to a SharePoint farm the simplest way is to add the person as a SharePoint Farm Administrator, but then you ignore that to enable the user to run PowerShell (PS) commands you also need to execute Add-SPShellAdmin. You typically notice that Add-SPShellAdmin has not been run for your account when you get the error message “The local Farm is not accessible” when starting a SharePoint PowerShell. Some more details to the difference between the Farm Administrators group and SPShellAdmin can be found in SharePoint 2010 PowerShell Permissions Explained.
Typically you execute something like this to fix the problem:
Add-SPShellAdmin –UserName contoso\mattias
Recently I was working with a customer who named all admin-accounts with a leading $-character, i.e. contoso\$mattias. Not being a true PS professional it took me some time to figure out that $ is a control character i PS. To be able to add an account with a leading $-character you need to add the escape character backward apostrophe (`).
So when using $-accounts you need to execute:
Add-SPShellAdmin –UserName contoso\`$mattias