Some of the dialogs in SSMS provide the PowerShell commands that perform what is being done through the UI allowing the DBA (for the want of a better term) to copy the script. I don't know that area off the top of my head and was hoping that a longshot suggestion might prove lucky. Sorry that it didn't.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!