Scripts

SQL Recovery Point Restore Script for SCDPM

This Powershell script for System Center Data Protection Manager script will Restore the latest recovery point for all SQL databases within specified protection group to a network folder. Please test thoroughly before use in a production environment. Rename with a .ps1 extension  

Script: Query Value from SQL Database (for 2-state monitor)

This sample monitoring script illustrates how run a T-SQL query on a database and sets monitor state based on value returned. Good example of how to dynamically create the connection string when database server & database name must be discovered at runtime. In this sample, we actually run a query to retrieve the ‘Pending Actions’ […]

Script: Query Value from SQL Database and Log Event

This sample monitoring script illustrates how run a T-SQL query on a database and log an event based on value returned. Good example of how to dynamically create the connection string when database server & database name must be discovered at runtime. In this sample, we actually run a query to retrieve the ‘Pending Actions’ […]

Resolve Alerts Older Than X Days in SCOM 2007

Resolves rule-generated alerts in SCOM 2007 older than X days old. Powershell script that resolves all alerts more than X days old in Operations Manager 2007. Includes connection string to RMS so the script can be run as a scheduled task to keep old alerts cleared out. Run with no arguments to echo syntax.

Hyper-V Host & Guest Maintenance Script

Powershell script prompts user for SCVMM Server and Hyper-V host and then 1) Marks Hyper-V host as unavailable for placement and 2) Takes a snapshot of all VMs on host and labels as “Checkpoint Before Hotfix Application” Designed to be run from the SCVMM Administrator Console (right-click launch from Library)

SQL Space Monitoring w/ Stored Procs (MOM 2005)

This is a SQL Space Monitoring that uses a stored procedure to get DB and log used space rather than relying on SQL DMO. Drawback is that you have to place the stored procedure in the master DB for each instance of SQL