{"id":639,"date":"2010-05-14T08:00:00","date_gmt":"2010-05-14T13:00:00","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=639"},"modified":"2014-03-15T10:16:13","modified_gmt":"2014-03-15T14:16:13","slug":"join-object","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/","title":{"rendered":"Join Object"},"content":{"rendered":"<p>Related to some of the WMI stuff I\u2019ve been working on lately is the idea of melding or joining objects. This comes about because I often see forum posts from administrators looking to collect information from different WMI classes but present it as a single object.<\/p>\n<p>One way you might accomplish this is to create a new, custom object with the <a title=\"get online help for this cmdlet\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113355\" target=\"_blank\">New-Object<\/a> cmdlet.<\/p>\n<pre class=\"lang:ps decode:true \" >#requires -version 2.0\r\n\r\nFunction Join-Object {\r\n\r\n&lt;#\r\n.Synopsis\r\n    Join multiple objects together into a single object.\r\n.Description\r\n    This function is designed to join, or merge two or more objects together. You can either pipe \r\n    objects via cmdlets to Join-Object or specify a comma separated list of objects. A new object\r\n    will be created with all unique properties and values from the original objects. If a property\r\n    is duplicated among objects but with a different value, then it will be renamed. For example,\r\n    if two objects both have a Name property but with different values, the custom object will have\r\n    properties of Name and Name_1.\r\n    \r\n    Join-Object works best with input objects that themselves are not arrays or collections of other\r\n    objects, but it can be done. The intent was to be able to merge related information into a single\r\n    object that you could then export or convert.\r\n    \r\n    If you are joining WMI objects, you might prefer to use the Select-WMI function to strip out system\r\n    properties like __CLASS. You can download this function from http:\/\/jdhitsolutions.com\/blog\/2010\/05\/select-wmi\/.\r\n    \r\n    By default the new object will contain a property called _TypeInformation which will store an array\r\n    of type information from the original objects. Use -NoTypeInformation to skip this.\r\n    \r\n    You can also include the original source objects in their \"raw\" state as part of the new object. \r\n    Specify -IncludeOriginal to store the input objects as an array in the _SourceObject property.\r\n.Parameter InputObject\r\n    Any valid PowerShell object. \r\n.Parameter IncludeOriginal\r\n    If specified, the original input object will be stored in an array\r\n    and be defined in the _SourceObject property on the new, custom object.\r\n.Parameter NoTypeInformation\r\n    By default, each input object's type is stored in an array and defined\r\n    in the _TypeInformation property on the new, custom object. If you do\r\n    not want this information, then specify this switch.\r\n.Example\r\n    PS C:\\&gt; (gwmi win32_computersystem),(gwmi win32_bios) | join-object\r\n\r\n    Combine two WMI objects into a single object.\r\n.Example\r\n    PS C:\\&gt; (gwmi win32_computersystem),(gwmi win32_bios) | select-wmi | join-object -NoTypeInformation\r\n    \r\n    Combine two WMI objects into a single object, but without the class properties. Select-WMI is a\r\n    third-party developed function you can download from http:\/\/jdhitsolutions.com\/blog\/2010\/05\/select-wmi\/\r\n.Example\r\n    PS C:\\&gt; $computers | foreach { (gwmi win32_operatingsystem -ComputerName $_),(gwmi win32_computersystem -ComputerName$_) | select-wmi | join-object} | export-csv c:\\temp\\sysreport.csv -NoTypeInformation\r\n    \r\n    Where $computers is a collection of computernames, get WMI information from two classes \r\n    (win32_operatingsystem and win32_computersystem). Join these two objects, stripping out \r\n    system properties and export the results to a csv file. Each computer will have it's own\r\n    custom object comprised of both WMI classes.\r\n.Example\r\n    PS C:\\&gt; $data=$fso.GetFile(\"c:\\pagefile.sys\"),$fso.GetDrive(\"c:\") | join-object -IncludeOriginal\r\n    \r\n    $fso is a COM FileSystemObject. The results of the two methods are joined and safved to $data. You can\r\n    view the original objects by looking at $data._SourceObjects\r\n.Inputs\r\n   Any valid object\r\n.Outputs\r\n    A custom object\r\n\r\n.Link\r\n    New-Object\r\n.Link\r\nhttp:\/\/jdhitsolutions.com\/blog\/2010\/05\/join-object\/\r\n\r\n.Notes\r\n     NAME:      Join-Object\r\n     VERSION:   1.0\r\n     AUTHOR:    Jeffery Hicks (@JeffHicks)\r\n     LASTEDIT:  May 12, 2010\r\n\r\n     Learn more:\r\n       PowerShell in Depth: An Administrator's Guide\r\n       PowerShell Deep Dives \r\n       Learn PowerShell 3 in a Month of Lunches \r\n       Learn PowerShell Toolmaking in a Month of Lunches \r\n\r\n     \"Those who forget to script are doomed to repeat their work.\"\r\n\r\n      ****************************************************************\r\n      * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED *\r\n      * THOROUGHLY IN A LAB ENVIRONMENT. USE AT YOUR OWN RISK.  IF   *\r\n      * YOU DO NOT UNDERSTAND WHAT THIS SCRIPT DOES OR HOW IT WORKS, *\r\n      * DO NOT USE IT OUTSIDE OF A SECURE, TEST SETTING.             *\r\n      ****************************************************************\r\n\r\n\r\n#&gt;\r\n   \r\n[CmdletBinding()]\r\nParam(\r\n    [Parameter(Position=0,\r\n               ValueFromPipeline=$True,\r\n               Mandatory=$True,\r\n               HelpMessage=\"Enter a valid PowerShell object\")]\r\n    [object[]]$Inputobject,\r\n    [switch]$IncludeOriginal,\r\n    [switch]$NoTypeInformation\r\n)  \r\nBegin {\r\n    write-verbose \"Starting $($myinvocation.mycommand)\"\r\n    #initialize a hash table for new properties\r\n    $newProp=@{}\r\n    #initialize a hash table to handle duplicate property names\r\n    $duplicate=@{}\r\n    #initialize an array to hold raw objects\r\n    $raw=@()\r\n    #initialize an array to hold object metadata\r\n    $metatypes=@()\r\n}\r\n\r\nProcess {\r\n  foreach ($parentobject in $InputObject) {\r\n  #handle inputobjects that are arrays themselves\r\n    foreach ($object in $parentobject) {\r\n    $raw+=$object\r\n    write-verbose \"Adding type $($object.GetType().Fullname)\"\r\n    $metaTypes+=$object.GetType().Fullname\r\n      $object | get-member -MemberType Properties | foreach {\r\n       \r\n        if ($newProp.Contains($_.name) ) {\r\n            write-Verbose \"Property $($_.name) already defined $($newProp.item($_.name))\"\r\n            #skip properties that have duplicate values\r\n            #only include the property if it has a different value\r\n            #and then rename the property like myProperty_1\r\n            if ($newProp.item($_.name) -ne $object.($_.Name)) { \r\n                $duplicate.item($_.name)+=1\r\n                $newName=$_.name+\"_\"+$duplicate.item($_.name)\r\n                write-Verbose \"Adding $newName =  $($object.($_.Name)).\"\r\n                $newProp.Add($newName,$object.($_.name))\r\n            }\r\n        }\r\n        else {\r\n            Write-Verbose \"Adding property $($_.name)\"\r\n            $newProp.Add($_.name,$object.($_.name))\r\n        }\r\n      } #foreach\r\n     } #foreach object\r\n  } #foreach parentobject\r\n\r\n} #Process\r\n\r\nEnd {\r\n    if ($IncludeOriginal) {\r\n        #add raw objects as a property\r\n        Write-Verbose \"Adding original raw objects\"\r\n        $newProp.Add(\"_SourceObjects\",$raw)\r\n    }\r\n    \r\n    if ($NoTypeInformation) {\r\n        write-verbose \"Skipping meta type information\"\r\n    }\r\n    else {\r\n        #add unique object metadata as a property\r\n        $newProp.Add(\"_TypeInformation\",($metaTypes | Select-object -unique))\r\n    }\r\n    \r\n    #write the new object to the pipeline\r\n    New-Object PSObject -Property $NewProp\r\n    write-verbose \"Ending $($myinvocation.mycommand)\"\r\n}\r\n    \r\n} #end Function\r\n\r\n#this script also defines an alias for this function.\r\nSet-Alias -Name jo -Value Join-Object \r\n<\/pre>\n<p>Join-Object will get the properties for each object and copy them to a new object. If a property name is duplicated with duplicate values, it is only added once. But if two objects have the same property but different values, then each subsequent property is renamed in incremented, eg Name, Name_1, Name_2.<\/p>\n<p>If using WMI objects, I suggest also using my <a href=\"http:\/\/jdhitsolutions.com\/blog\/2010\/05\/select-wmi\/\" target=\"_blank\">Select-WMI<\/a> function to strip out the system classes.<\/p>\n<p>Join-Object works best with objects that are not collections of objects themselves. It will work, but gets a little tricky to sort out.<\/p>\n<p>I also include metadata information in the new object based on the input objects. Each input object type is stored as an array in the _TypeInformation property. You can skip this by using the \u2013NoTypeInformation parameter. Similarly, you can elect to include the \u201craw\u201d, input objects with \u2013IncludeOriginal. The new object will have a _SourceObjects property.<\/p>\n<p>As always, I hope you\u2019ll let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Related to some of the WMI stuff I\u2019ve been working on lately is the idea of melding or joining objects. This comes about because I often see forum posts from administrators looking to collect information from different WMI classes but present it as a single object. One way you might accomplish this is to create&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[75,8],"tags":[32,190,144,534],"class_list":["post-639","post","type-post","status-publish","format-standard","hentry","category-powershell-v2-0","category-scripting","tag-functions","tag-new-object","tag-objects","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Join Object &#8226; The Lonely Administrator<\/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:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Join Object &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Related to some of the WMI stuff I\u2019ve been working on lately is the idea of melding or joining objects. This comes about because I often see forum posts from administrators looking to collect information from different WMI classes but present it as a single object. One way you might accomplish this is to create...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2010-05-14T13:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-03-15T14:16:13+00:00\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/639\\\/join-object\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/639\\\/join-object\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Join Object\",\"datePublished\":\"2010-05-14T13:00:00+00:00\",\"dateModified\":\"2014-03-15T14:16:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/639\\\/join-object\\\/\"},\"wordCount\":226,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"functions\",\"new-object\",\"objects\",\"PowerShell\"],\"articleSection\":[\"PowerShell v2.0\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/639\\\/join-object\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/639\\\/join-object\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/639\\\/join-object\\\/\",\"name\":\"Join Object &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2010-05-14T13:00:00+00:00\",\"dateModified\":\"2014-03-15T14:16:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/639\\\/join-object\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/639\\\/join-object\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/639\\\/join-object\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell v2.0\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell-v2-0\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Join Object\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Join Object &#8226; The Lonely Administrator","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:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/","og_locale":"en_US","og_type":"article","og_title":"Join Object &#8226; The Lonely Administrator","og_description":"Related to some of the WMI stuff I\u2019ve been working on lately is the idea of melding or joining objects. This comes about because I often see forum posts from administrators looking to collect information from different WMI classes but present it as a single object. One way you might accomplish this is to create...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/","og_site_name":"The Lonely Administrator","article_published_time":"2010-05-14T13:00:00+00:00","article_modified_time":"2014-03-15T14:16:13+00:00","author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Join Object","datePublished":"2010-05-14T13:00:00+00:00","dateModified":"2014-03-15T14:16:13+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/"},"wordCount":226,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["functions","new-object","objects","PowerShell"],"articleSection":["PowerShell v2.0","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/","name":"Join Object &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2010-05-14T13:00:00+00:00","dateModified":"2014-03-15T14:16:13+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell v2.0","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},{"@type":"ListItem","position":2,"name":"Join Object"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":654,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/654\/new-wmi-object\/","url_meta":{"origin":639,"position":0},"title":"New WMI Object","author":"Jeffery Hicks","date":"May 17, 2010","format":false,"excerpt":"I have one more variation on my recent theme of working with WMI objects. I wanted to come up with something flexible and re-usable where you could specify a WMI class and some properties and get a custom object with all the classes combined. My solution is a function called\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1603,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/","url_meta":{"origin":639,"position":1},"title":"Select Object Properties with Values","author":"Jeffery Hicks","date":"August 16, 2011","format":false,"excerpt":"Here's another concept I know I've written about in the past but that needed an update. A common technique I use when exploring and discovering objects is to pipe the object to Select-Object specifying all properties, get-service spooler | select *. There's nothing wrong with this approach but depending on\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9074,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9074\/the-value-of-objects\/","url_meta":{"origin":639,"position":2},"title":"The Value of Objects","author":"Jeffery Hicks","date":"July 5, 2022","format":false,"excerpt":"This is a reprint of an article published earlier this year in my premium PowerShell newsletter, Behind the PowerShell Pipeline. This is a sample of what my subscribers get 6-8 times a month. I expect I will write several articles about PowerShell and its relationship with objects. I know that\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/07\/getting-drive-usage.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/07\/getting-drive-usage.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/07\/getting-drive-usage.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2740,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2740\/join-powershell-hash-tables\/","url_meta":{"origin":639,"position":3},"title":"Join PowerShell Hash Tables","author":"Jeffery Hicks","date":"January 23, 2013","format":false,"excerpt":"I received a lot of feedback and interest in my ConvertTo-Hashtable function. One question I received was \"Why?\" Well, one reason might be that you want to combine two objects into a single object. Joining them as two hashtables makes this an easier process. First off, combining two hashtables is\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"handshake","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/handshake.gif?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":636,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/636\/select-wmi\/","url_meta":{"origin":639,"position":4},"title":"Select WMI","author":"Jeffery Hicks","date":"May 13, 2010","format":false,"excerpt":"I\u2019ve been helping out on some WMI and PowerShell issues in the forums at ScriptingAnswers.com. As I was working on a problem I ended up taking a slight detour to address an issue that has always bugged me. When I run a command like this: get-wmiobject -query \"Select Name,Description,Disabled from\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"selectwmi","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/05\/selectwmi-300x89.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":8465,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8465\/filtering-powershell-unique-objects\/","url_meta":{"origin":639,"position":5},"title":"Filtering for Unique Objects in PowerShell","author":"Jeffery Hicks","date":"July 1, 2021","format":false,"excerpt":"A few weeks ago my friend, Gladys Kravitz, was lamenting about a challenge related to filtering for unique objects. PowerShell has a Get-Unique cmdlet, and Select-Object has a -Unique parameter, but these options are limited. On one hand, I'd say most things we manage with PowerShell are guaranteed to be\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/2021-07-01_12-55-46.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/639","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=639"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/639\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}