May 18, 2015 at 10:39 pm
I am looking for a sample PowerShell script that allows me to verify that showplan is enabled for a user on a SQL Server 2012 instance. Haven't figured out how to code it.
May 19, 2015 at 5:38 am
well, start at SQL first.
do you want to test implied/inferred permissions, or just explicitly granted permissions?
sysadmin, or anyone in a db_owner roles would of course have showplan permissions in the database in question, and then you can test for explicitly added permissions where someone rant GRANT SHOWPLAN TO [mydomain\myuser]
also, showplan is inherited if somone was granted ALTER TRACE, or VIEW SERVER STATE as well.
what if someone granted showplan to a role the user happens to be in? or a nested role within a role?
there's lots of permissions scripts out in the scripts section, i'd dig through there instead of reinventing the wheel, and then i could call that script via powershell.
the place to start is mapping what permissions youa re after...just explicitygrants, or implied/inherited as well.
Lowell
May 25, 2015 at 1:37 pm
I wanted to test the explicitly granted showplan permissions.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply