This is a beautiful bit of script that allows you to set DB permissions for a user. This is particularly useful for adding a user to multiple DBs on the server. And the code to accomplish this is much shorter than its T-SQL counterpart. If you need a bit more explanation about how this is put together then look at the video for granting schema permissions with Powershell.
Grant DB Permissions
