{"id":303,"date":"2011-12-15T21:24:49","date_gmt":"2011-12-15T20:24:49","guid":{"rendered":"http:\/\/henrik.familiendamgaard.dk\/blog\/?p=303"},"modified":"2011-12-16T17:39:31","modified_gmt":"2011-12-16T16:39:31","slug":"create-event-source-with-powershell","status":"publish","type":"post","link":"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/","title":{"rendered":"Create Event Source with PowerShell"},"content":{"rendered":"<p>To create a Event Source in PowerShell use this:<\/p>\n<pre escaped=\"true\" lang=\"powershell\" line=\"1\">$Source = \"MyEventSource\"\r\nif ([System.Diagnostics.EventLog]::SourceExists($Source) -eq $false {\r\n  [System.Diagnostics.EventLog]::CreateEventSource($Source, \"Application\")\r\n}<\/pre>\n<p>Get more info on CreateEventSource method here :\u00a0<a title=\"CreateEventSource\" href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/2awhba7a.aspx\" target=\"_blank\">http:\/\/msdn.microsoft.com\/en-us\/library\/2awhba7a.aspx<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>In PowerShell 2.0 this is even simpler:<\/p>\n<pre escaped=\"true\" lang=\"powershell\" line=\"1\">$Source = \"MyEventSource\"\r\nNew-EventLog -LogName Application -Source $Source<\/pre>\n<p>&nbsp;<\/p>\n<!-- AddThis Share Buttons generic via filter on the_content -->\n<!-- AddThis Related Posts generic via filter on the_content -->\n","protected":false},"excerpt":{"rendered":"<p>To create a Event Source in PowerShell use this: $Source = &#8220;MyEventSource&#8221; if ([System.Diagnostics.EventLog]::SourceExists($Source) -eq $false { [System.Diagnostics.EventLog]::CreateEventSource($Source, &#8220;Application&#8221;) } Get more info on CreateEventSource method here :\u00a0http:\/\/msdn.microsoft.com\/en-us\/library\/2awhba7a.aspx &nbsp; In PowerShell 2.0 this is even simpler: $Source = &#8220;MyEventSource&#8221; New-EventLog -LogName Application -Source $Source &nbsp;<!-- AddThis Share Buttons generic via filter on wp_trim_excerpt --><br \/>\n<!-- AddThis Related Posts generic via filter on wp_trim_excerpt --><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[32,24],"tags":[44,179,178,79,46,45],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.6.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create Event Source with PowerShell \u00bb PowerShell, Server \u00bb SYN, SYN-ACK, ACK<\/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:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Henrik Damgaard\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/\",\"url\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/\",\"name\":\"Create Event Source with PowerShell \u00bb PowerShell, Server \u00bb SYN, SYN-ACK, ACK\",\"isPartOf\":{\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/#website\"},\"datePublished\":\"2011-12-15T20:24:49+00:00\",\"dateModified\":\"2011-12-16T16:39:31+00:00\",\"author\":{\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/#\/schema\/person\/df8ef26ea249218b5e03146bc0b33945\"},\"breadcrumb\":{\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Create Event Source with PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/#website\",\"url\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/\",\"name\":\"SYN, SYN-ACK, ACK\",\"description\":\"Henrik Damgaard\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/#\/schema\/person\/df8ef26ea249218b5e03146bc0b33945\",\"name\":\"Henrik Damgaard\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-content\/uploads\/2014\/04\/henrik.familiendamgaard.dk-henrik.jpg\",\"contentUrl\":\"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-content\/uploads\/2014\/04\/henrik.familiendamgaard.dk-henrik.jpg\",\"caption\":\"Henrik Damgaard\"},\"description\":\"Hi I\u2019m Henrik and I write this blog based on useful topics I find interesting \u2013 mostly covering some of my technical interests : System Center Operations Manager (SCOM), BizTalk, Windows Server, PowerShell, SQL server, Internet Information Services, PHP and .NET I am currently holding a position as System Administrator with focus on Microsoft server products.\",\"sameAs\":[\"https:\/\/www.google.com\/accounts\/o8\/id?id=AItOawm9nhUQo8VH_qbGDFWjC6z6lwgwvf8pZWQ\",\"http:\/\/www.facebook.com\/nrjizer\",\"http:\/\/linkedin.com\/in\/henrikdamgaard\",\"https:\/\/twitter.com\/http:\/\/twitter.com\/nrjizer\"],\"url\":\"http:\/\/henrik.familiendamgaard.dk\/blog\/author\/henrik\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create Event Source with PowerShell \u00bb PowerShell, Server \u00bb SYN, SYN-ACK, ACK","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:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/","twitter_misc":{"Written by":"Henrik Damgaard"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/","url":"https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/","name":"Create Event Source with PowerShell \u00bb PowerShell, Server \u00bb SYN, SYN-ACK, ACK","isPartOf":{"@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/#website"},"datePublished":"2011-12-15T20:24:49+00:00","dateModified":"2011-12-16T16:39:31+00:00","author":{"@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/#\/schema\/person\/df8ef26ea249218b5e03146bc0b33945"},"breadcrumb":{"@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/2011\/12\/15\/create-event-source-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Create Event Source with PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/#website","url":"https:\/\/henrik.familiendamgaard.dk\/blog\/","name":"SYN, SYN-ACK, ACK","description":"Henrik Damgaard","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/henrik.familiendamgaard.dk\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/#\/schema\/person\/df8ef26ea249218b5e03146bc0b33945","name":"Henrik Damgaard","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/#\/schema\/person\/image\/","url":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-content\/uploads\/2014\/04\/henrik.familiendamgaard.dk-henrik.jpg","contentUrl":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-content\/uploads\/2014\/04\/henrik.familiendamgaard.dk-henrik.jpg","caption":"Henrik Damgaard"},"description":"Hi I\u2019m Henrik and I write this blog based on useful topics I find interesting \u2013 mostly covering some of my technical interests : System Center Operations Manager (SCOM), BizTalk, Windows Server, PowerShell, SQL server, Internet Information Services, PHP and .NET I am currently holding a position as System Administrator with focus on Microsoft server products.","sameAs":["https:\/\/www.google.com\/accounts\/o8\/id?id=AItOawm9nhUQo8VH_qbGDFWjC6z6lwgwvf8pZWQ","http:\/\/www.facebook.com\/nrjizer","http:\/\/linkedin.com\/in\/henrikdamgaard","https:\/\/twitter.com\/http:\/\/twitter.com\/nrjizer"],"url":"http:\/\/henrik.familiendamgaard.dk\/blog\/author\/henrik\/"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/posts\/303"}],"collection":[{"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/comments?post=303"}],"version-history":[{"count":3,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/posts\/303\/revisions"}],"predecessor-version":[{"id":305,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/posts\/303\/revisions\/305"}],"wp:attachment":[{"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/media?parent=303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/categories?post=303"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/tags?post=303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}