{"id":285,"date":"2011-11-27T22:15:36","date_gmt":"2011-11-27T21:15:36","guid":{"rendered":"http:\/\/henrik.familiendamgaard.dk\/blog\/?p=285"},"modified":"2011-11-28T09:25:02","modified_gmt":"2011-11-28T08:25:02","slug":"handling-attributes-with-hyphens-in-powershell","status":"publish","type":"post","link":"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/","title":{"rendered":"Handling attributes with hyphens in PowerShell"},"content":{"rendered":"<p>Sometimes we need working with PowerShell objects which have attributes with hyphens. That can be a bit difficult as PowerShell assumes hyphens are used with operators and parameters.<\/p>\n<p>Below is an example on how to get around this, and rename the attribute:<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<pre escaped=\"true\" lang=\"powershell\" line=\"1\">$Users = Get-AdUser -Filter * -Property \"msDS-ResultantPSO\" | Select name, @{Name=\"ResultantPSO\";Expression={$_.\"msDS-ResultantPSO\"}}<\/pre>\n<p>&nbsp;<\/p>\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>Sometimes we need working with PowerShell objects which have attributes with hyphens. That can be a bit difficult as PowerShell assumes hyphens are used with operators and parameters. Below is an example on how to get around this, and rename the attribute: &nbsp; &nbsp; $Users = Get-AdUser -Filter * -Property &#8220;msDS-ResultantPSO&#8221; | Select name, @{Name=&#8221;ResultantPSO&#8221;;Expression={$_.&#8221;msDS-ResultantPSO&#8221;}} &hellip; <a href=\"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Handling attributes with hyphens in PowerShell<\/span><\/a><!-- 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":[50,32],"tags":[71,70,179,178],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.6.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Handling attributes with hyphens in PowerShell \u00bb Active Directory, PowerShell \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=\"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-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\":\"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/\",\"url\":\"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/\",\"name\":\"Handling attributes with hyphens in PowerShell \u00bb Active Directory, PowerShell \u00bb SYN, SYN-ACK, ACK\",\"isPartOf\":{\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/#website\"},\"datePublished\":\"2011-11-27T21:15:36+00:00\",\"dateModified\":\"2011-11-28T08:25:02+00:00\",\"author\":{\"@id\":\"https:\/\/henrik.familiendamgaard.dk\/blog\/#\/schema\/person\/df8ef26ea249218b5e03146bc0b33945\"},\"breadcrumb\":{\"@id\":\"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Handling attributes with hyphens in 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":"Handling attributes with hyphens in PowerShell \u00bb Active Directory, PowerShell \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":"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/","twitter_misc":{"Written by":"Henrik Damgaard"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/","url":"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/","name":"Handling attributes with hyphens in PowerShell \u00bb Active Directory, PowerShell \u00bb SYN, SYN-ACK, ACK","isPartOf":{"@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/#website"},"datePublished":"2011-11-27T21:15:36+00:00","dateModified":"2011-11-28T08:25:02+00:00","author":{"@id":"https:\/\/henrik.familiendamgaard.dk\/blog\/#\/schema\/person\/df8ef26ea249218b5e03146bc0b33945"},"breadcrumb":{"@id":"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/henrik.familiendamgaard.dk\/blog\/2011\/11\/27\/handling-attributes-with-hyphens-in-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Handling attributes with hyphens in 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\/285"}],"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=285"}],"version-history":[{"count":2,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/posts\/285\/revisions"}],"predecessor-version":[{"id":287,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/posts\/285\/revisions\/287"}],"wp:attachment":[{"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/media?parent=285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/categories?post=285"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/henrik.familiendamgaard.dk\/blog\/wp-json\/wp\/v2\/tags?post=285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}