This is the Add-Res-Mailbox-Permission.ps1 sample script. It goes with the following blog post:
http://msexchangeteam.com/archive/2007/12/13/447731.aspx