SQL Server Power Search - Get More Relevant Results

SQL Server Audit Script - Part 2

In the first part of this article I mentioned that a SQL Server Audit is often a time consuming manual process and provided screenshots from a script that makes the job much easier. In the second part I give you the code and explain how to set it up.

First, the code. Create a file called SQL Audit.hta, open it with notepad and paste the following into it:
Now create a file called SQL Servers.xml and save it to the same folder, open it with notepad and paste the following xml into it:


This should be fairly self-explanatory. The name attributes may contain a server name or ip address. The desc attributes contain what is displayed to the user. Windows and SQL Server authentication are both supported, and I have shown examples of each. The grouping is useful in a large environment. You can have as many groups as you like.

Replace my example servers and instances with ones from your own environment and save the file. Now double-click on SQL Audit.hta to run the script.

The script uses WMI to retrieve the server configuration. Please be aware that there can be a problem with WMI on some servers, causing it to hang indefinitely. The offending server will have to be removed from the xml file when this happens, unless you know of a fix for the problem (in which case please contact me).

When I make future changes to this SQL Server audit script I will describe them in a new article, so be sure to subscribe to my RSS feed.