~/2014/02/10/oncommand-core-delete-all-information-events.md

PowerShell: OnCommand Core – Delete All Information Events

---
author: 
date: 
updated: 
read: 1 min
in:   [ps, scripts]
tags: [dfm, netapp, oncommand, powershell]
---

$ grep -n '^#' post.md

Found a solution on the NetApp communities for deleting the Informational events that plague OnCommand Core.

Requirements

  • The Data ONTAP dfm command-line tool, available on the OnCommand Core server.
  • A PowerShell prompt on the OnCommand Core server, and an account allowed to list and delete events.

Usage

Run this in PowerShell on the OnCommand Core server. It lists the IDs of all Information events and deletes them one at a time.

powershell
dfm event list -q -S information |
    Select-String -Pattern "(?<ID>[0-9]+)" |
    Select-Object @{Name = "ID"; Expression = { $_.Matches[0].Groups["ID"].Value }} |
    ForEach-Object { dfm event delete $_.ID }

Notes

  • dfm event list -q -S information is the key part of this line. It prints only the IDs of the events whose severity is Information.
  • Select-String picks the numeric event ID out of each line, Select-Object turns it into an ID property, and ForEach-Object calls dfm event delete with each ID.
  • If you’d want to delete all events, remove the -S information from the line. This deletes events of every severity, so use it with care.

Source

https://communities.netapp.com/message/94591#94591