{"id":4518,"date":"2011-12-16T09:08:00","date_gmt":"2011-12-16T09:08:00","guid":{"rendered":"https:\/\/www.sotec.eu\/?p=4518"},"modified":"2025-09-04T12:50:32","modified_gmt":"2025-09-04T12:50:32","slug":"writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell","status":"publish","type":"post","link":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/","title":{"rendered":"Writing event log entries to the Windows event log as any source (using the Power Shell)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">First off, sorry for writing so much about management packs. However this might help you somewhere else as well. Today I want to show you how it\u2019s possible to write events to the windows event log as any event source. I needed this to test simple event log monitors within the SCOM Authoring console. So, now I can test the Management Pack behavior without actually installing the application on my local machine (some errors and event log entries are hard to reproduce, this will help with those as well). Usually windows will not allow you to write events as an event source that doesn\u2019t exist yet. Easy enough, fire up the Windows Power Shell (with right click -&gt; run as administrator). Enter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>&#91;System.Diagnostics.EventLog]::CreateEventSource(\"YourEventSource\", \"Application\")<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now that you have your event source you can write events in any way you like. Since you\u2019re already in the power shell you might as well use it. Enter something like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>Write-EventLog -logname Application -source YourEventSource -eventID 6666 -entrytype Information -message \"Simulated Event\" -category 1 -rawdata 10,20<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">(Get help on the command by typing \u201cGet-Help Write-EventLog -full\u201d. You can add something like \u201c&gt; c:\\myhelp.txt\u201d to write it to a file and open it in an editor window. Makes things easier.) Since we are good programmers, we clean up when the work is done. So here\u2019s the command to delete the Event Source:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>&#91;System.Diagnostics.EventLog]::DeleteEventSource(\"YourEventSource\")<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now this information is all available on Google but I haven\u2019t found it compiled in a single article so maybe this will help.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>First off, sorry for writing so much about management packs. However this might help you somewhere else as well. Today I want to show you how it\u2019s possible to write events to the windows event log as any event source. I needed this to test simple event log monitors within the SCOM Authoring console.<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4518","post","type-post","status-publish","format-standard","hentry","category-nicht-kategorisiert"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Writing event log entries to the Windows event log as any source (using the Power Shell) - SOTEC<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Writing event log entries to the Windows event log as any source (using the Power Shell) - SOTEC\" \/>\n<meta property=\"og:description\" content=\"First off, sorry for writing so much about management packs. However this might help you somewhere else as well. Today I want to show you how it\u2019s possible to write events to the windows event log as any event source. I needed this to test simple event log monitors within the SCOM Authoring console.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/\" \/>\n<meta property=\"og:site_name\" content=\"SOTEC\" \/>\n<meta property=\"article:published_time\" content=\"2011-12-16T09:08:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-04T12:50:32+00:00\" \/>\n<meta name=\"author\" content=\"Anna Akinchyna\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anna Akinchyna\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\\\/\"},\"author\":{\"name\":\"Anna Akinchyna\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/#\\\/schema\\\/person\\\/07cb9b84a952982037f22f56d491df03\"},\"headline\":\"Writing event log entries to the Windows event log as any source (using the Power Shell)\",\"datePublished\":\"2011-12-16T09:08:00+00:00\",\"dateModified\":\"2025-09-04T12:50:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\\\/\"},\"wordCount\":256,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/#organization\"},\"articleSection\":[\"Nicht kategorisiert\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.sotec.eu\\\/en\\\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\\\/\",\"url\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\\\/\",\"name\":\"Writing event log entries to the Windows event log as any source (using the Power Shell) - SOTEC\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/#website\"},\"datePublished\":\"2011-12-16T09:08:00+00:00\",\"dateModified\":\"2025-09-04T12:50:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sotec.eu\\\/en\\\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Writing event log entries to the Windows event log as any source (using the Power Shell)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/\",\"name\":\"SOTEC\",\"description\":\"Engineering for Digital Transformation\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/#organization\",\"name\":\"SOTEC\",\"url\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.sotec.eu\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/logo-en-raster-1-scaled.png\",\"contentUrl\":\"https:\\\/\\\/www.sotec.eu\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/logo-en-raster-1-scaled.png\",\"width\":2560,\"height\":634,\"caption\":\"SOTEC\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/#\\\/schema\\\/person\\\/07cb9b84a952982037f22f56d491df03\",\"name\":\"Anna Akinchyna\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g\",\"caption\":\"Anna Akinchyna\"},\"url\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/author\\\/a-akinchynasotec-eu\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Writing event log entries to the Windows event log as any source (using the Power Shell) - SOTEC","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/","og_locale":"en_US","og_type":"article","og_title":"Writing event log entries to the Windows event log as any source (using the Power Shell) - SOTEC","og_description":"First off, sorry for writing so much about management packs. However this might help you somewhere else as well. Today I want to show you how it\u2019s possible to write events to the windows event log as any event source. I needed this to test simple event log monitors within the SCOM Authoring console.","og_url":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/","og_site_name":"SOTEC","article_published_time":"2011-12-16T09:08:00+00:00","article_modified_time":"2025-09-04T12:50:32+00:00","author":"Anna Akinchyna","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Anna Akinchyna","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/#article","isPartOf":{"@id":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/"},"author":{"name":"Anna Akinchyna","@id":"https:\/\/www.sotec.eu\/en\/#\/schema\/person\/07cb9b84a952982037f22f56d491df03"},"headline":"Writing event log entries to the Windows event log as any source (using the Power Shell)","datePublished":"2011-12-16T09:08:00+00:00","dateModified":"2025-09-04T12:50:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/"},"wordCount":256,"commentCount":0,"publisher":{"@id":"https:\/\/www.sotec.eu\/en\/#organization"},"articleSection":["Nicht kategorisiert"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/","url":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/","name":"Writing event log entries to the Windows event log as any source (using the Power Shell) - SOTEC","isPartOf":{"@id":"https:\/\/www.sotec.eu\/en\/#website"},"datePublished":"2011-12-16T09:08:00+00:00","dateModified":"2025-09-04T12:50:32+00:00","breadcrumb":{"@id":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sotec.eu\/en\/writing-event-log-entries-to-the-windows-event-log-as-any-source-using-the-power-shell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/www.sotec.eu\/en\/"},{"@type":"ListItem","position":2,"name":"Writing event log entries to the Windows event log as any source (using the Power Shell)"}]},{"@type":"WebSite","@id":"https:\/\/www.sotec.eu\/en\/#website","url":"https:\/\/www.sotec.eu\/en\/","name":"SOTEC","description":"Engineering for Digital Transformation","publisher":{"@id":"https:\/\/www.sotec.eu\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sotec.eu\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.sotec.eu\/en\/#organization","name":"SOTEC","url":"https:\/\/www.sotec.eu\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sotec.eu\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.sotec.eu\/wp-content\/uploads\/2024\/11\/logo-en-raster-1-scaled.png","contentUrl":"https:\/\/www.sotec.eu\/wp-content\/uploads\/2024\/11\/logo-en-raster-1-scaled.png","width":2560,"height":634,"caption":"SOTEC"},"image":{"@id":"https:\/\/www.sotec.eu\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.sotec.eu\/en\/#\/schema\/person\/07cb9b84a952982037f22f56d491df03","name":"Anna Akinchyna","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g","caption":"Anna Akinchyna"},"url":"https:\/\/www.sotec.eu\/en\/author\/a-akinchynasotec-eu\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/posts\/4518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/comments?post=4518"}],"version-history":[{"count":1,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/posts\/4518\/revisions"}],"predecessor-version":[{"id":4519,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/posts\/4518\/revisions\/4519"}],"wp:attachment":[{"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/media?parent=4518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/categories?post=4518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/tags?post=4518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}