SQL Server: Output service accounts with system roles

 Hey, did you just inherit an environment with we'll call it "incomplete standards"? Are you going through the first steps of some regulatory-like audit and need to report on SQL Server service accounts? Are you just curious? Give this a try.

This script is intended to record SQL Server service account data for the database engine and the SQL Server Agent. This isn't intended to observe AS, IS, or RS. If you look at the logic, you could probably piece the story together if you wanted.

I run this script using SSMS Registered Servers for ease of use. You could easily execute this with invoke-sqlcmd or the PSDbaTools equivalent. For me, I wanted to rope in 100+ servers and post up their service accounts and what permissiosn those service accounts have for all to see. A bit of a list of shame. Do with this as you will!




Feel free to leave comments or suggestions. I posted this for me to remember it someday, hope it helps you if you find it!



Comments