---
title: SCOM 2012 Channels and Subscriptions - Adding a Script to Log Alert Descriptions to a File
description: We’ve run across a few clients wanting to save alerts or descriptions to a file. We’ll just tackle the process via subscription and channel.
---

[Blog - AdaptivEdge](https://info.adaptivedge.com/blog)

# [SCOM 2012 Channels and Subscriptions - Adding a Script to Log Alert Descriptions to a File](https://info.adaptivedge.com/blog/2015/10/19/scom-2012-channels-and-subscriptions-adding-a-script-to-log-alert-descriptions-to-a-file)

 Written by [aeadmin](https://info.adaptivedge.com/blog/author/aeadmin) | Oct 19, 2015 12:14:05 PM

**Audience – Intermediate Level of Expertise with SCOM**

We’ve run across a few clients wanting to save alerts or descriptions to a file. There are a few ways to do this, but we’ll just tackle the process via subscription and channel.

First, create a PowerShell script and save on your management server(s). Save as channelforlogging.ps1 (or whatever name makes sense for you):

Param (\[String\]$AlertName,\[String\]$SubscriptionID)

$Logstring = $AlertName + " " + $SubscriptionID

$Logfile = "<share name or local drive>\\adminaudit$\\LogAlert.log"

$DateTime = Get-Date -Uformat "%y-%m-%d %H:%M:%S"

$Logstring = $DateTime + " " + $Logstring

Add-content $Logfile -value $Logstring

Then, create a new Command Channel (New, Channel, choose Command as the type) with the following settings:

Full Path of Command Line

"<path of script>\\channelforlogging.ps1" '$Data/Context/DataItem/AlertDescription$' $MPElement$'

Command Line Parameters

c:\\windows\\system32\\windowspowershell\\v1.0\\powershell.exe

Startup Folder for the Command Line

c:\\windows\\system32\\windowspowershell\\v1.0\\

After the Command Channel is created, you can then create a subscription using the channel you’ve created. Then test and adjust as needed.

**Written and composed by one of our Senior Microsoft System Center Architects, Jessica Ervin-Hang**

[View full post](https://info.adaptivedge.com/blog/2015/10/19/scom-2012-channels-and-subscriptions-adding-a-script-to-log-alert-descriptions-to-a-file)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "aeadmin"
  },
  "dateModified" : "2018-05-31T19:01:39.632Z",
  "datePublished" : "2015-10-19T12:14:05Z",
  "headline" : "SCOM 2012 Channels and Subscriptions - Adding a Script to Log Alert Descriptions to a File",
  "image" : {
    "@type" : "ImageObject",
    "height" : 683,
    "url" : "http://info.adaptivedge.com/hubfs/Imported_Blog_Media/adaptivedge-scom.jpg",
    "width" : 1024
  },
  "mainEntityOfPage" : "https://info.adaptivedge.com/blog/2015/10/19/scom-2012-channels-and-subscriptions-adding-a-script-to-log-alert-descriptions-to-a-file",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "Blog"
  }
}
```