Use PowerShell to determine which registered SQL Servers have the ENABLED GUEST user with HTML output.
Tasks:
- Extract the list of all registered SQL servers.
- Get a T-SQL script ready.
- Get the HTML and CSS style ready.
- Combine them in PowerShell.
In most cases, locating a user within a SQL server is rather simple. The new system table or the conventional system table can be used.
sysusers
sys.database_principals
However, the user's enabled or disabled status, which is only available through the table, is: sys.sysusers. Let's get right to the coding.