-
Book Overview & Buying
-
Table Of Contents
SQL Server 2012 with PowerShell V3 Cookbook
By :
In this recipe, we will set up a simple WMI Server event alert for a DDL event.
We will set up an alert that creates a timestamped text file every time there is a DDL Login event (CREATE, ALTER, or DROP). We will utilize the WMI provider for server events in this exercise.
These are the values you will need to know:
|
Item |
Value |
|---|---|
|
Namespace (if using the default instance) |
|
|
Namespace (if using a named instance) |
|
|
WMI query |
SELECT * FROM DDL_LOGIN_EVENTS |
|
|
|
For WMI events hitting SQL Server, you will also need to ensure that SQL Server Broker is running on your target database. In our case, we need to ensure that the Broker is running on the msdb database.
SELECT is_broker_enabled, * FROM sys.databases ORDER BY name
Check the msdb...