~/2014/02/10/oncommand-core-delete-all-information-events.md
PowerShell: OnCommand Core – Delete All Information Events
--- author: Tom Lasswell 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
dfmcommand-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.
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 informationis the key part of this line. It prints only the IDs of the events whose severity is Information.Select-Stringpicks the numeric event ID out of each line,Select-Objectturns it into anIDproperty, andForEach-Objectcallsdfm event deletewith each ID.- If you’d want to delete all events, remove the
-S informationfrom the line. This deletes events of every severity, so use it with care.