{"id":1603,"date":"2011-08-16T09:45:04","date_gmt":"2011-08-16T13:45:04","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1603"},"modified":"2011-08-12T14:50:21","modified_gmt":"2011-08-12T18:50:21","slug":"select-object-properties-with-values","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/","title":{"rendered":"Select Object Properties with Values"},"content":{"rendered":"<p>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 the object I might get a lot of empty values. This is especially true with WMI objects or items from Active Directory like a user account. The other issue I have is that when using this technique with a WMI object, I also get the system properties like __PATH, which I'd often like to ignore. The solution I came up is a function called Select-PropertyValue. Pipe objects to the function and it will write a custom object to the pipeline only with properties that have a value.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nFunction Select-PropertyValue {<br \/>\n[cmdletbinding()]<\/p>\n<p>Param(<br \/>\n[Parameter(Position=0,ValueFromPipeline=$True)]<br \/>\n[object]$InputObject,<br \/>\n[Switch]$NoSystem,<br \/>\n[Switch]$Inquire = $False<br \/>\n)<\/p>\n<p>Begin {<br \/>\n  Write-Verbose \"Starting $($myinvocation.mycommand)\" <\/p>\n<p>  #define a variable we will be using to keep StrictMode happy.<br \/>\n  $properties=@()<br \/>\n} #begin<\/p>\n<p>Process {<\/p>\n<p> <#\n  set debug preference to continue when using -Debug unless user\n  has also used -Inquire. Otherwise, PowerShell will prompt\n  for each command. Due to scoping issues I found the best solution\n  was to set the debug preference for each object in the pipeline\n  #><\/p>\n<p>  if (($PSCmdlet.MyInvocation.BoundParameters.ContainsKey(\"debug\")) -AND (-NOT $Inquire)) {<br \/>\n      $DebugPreference=\"Continue\"<br \/>\n  }<\/p>\n<p>Write-Debug \"In process\"<br \/>\nWrite-Debug \"Checking for `$properties\"<br \/>\n<#\nbecause this only takes pipelined objects, we only need to get the properties from \nGet-Member once. When the second object is processed, this IF block will get skipped.\nThe assumption that all pipelined objects are of the same type.\n#><\/p>\n<p>if (-Not $properties) {<br \/>\n    Write-Verbose \"Creating property list\"<br \/>\n    Write-Debug \"Creating property list for pipelined object\"<\/p>\n<p>    #get properties for the pipelined object sorted by property name<br \/>\n    $properties=$_ | Get-Member -membertype Properties | sort Name<br \/>\n    $typename=($_ |Get-Member)[0].TypeName<br \/>\n    Write-Debug \"Typename =$typename\"<\/p>\n<p>    #filter out WMI System properties if -NoSystem<br \/>\n    if ($NoSystem) {<br \/>\n        Write-Verbose \"Filtering out WMI System properties\"<br \/>\n        Write-Debug \"Filtering out WMI System properties.\"<br \/>\n        $properties=$properties | where {$_.name -notlike \"__*\"}<br \/>\n    }<\/p>\n<p>    Write-Verbose \"Found $($properties.count) properties\"<br \/>\n    Write-Debug \"Found $($properties.count) properties\"<br \/>\n}<\/p>\n<p> #create an empty custom object<br \/>\n Write-Debug \"Creating empty object\"<br \/>\n $obj=New-Object PSObject<\/p>\n<p>#enumerate the list of properties<br \/>\nWrite-Verbose \"Checking properties for values\"<br \/>\nforeach ($property in $properties) {<br \/>\n    Write-Debug \"Checking $($property.name)\"<br \/>\n     #if object has a value for the current property<br \/>\n     if ($_.($property.name)) {<br \/>\n        Write-Debug \"found value for: $($_.($property.name))\"<\/p>\n<p>        #assign properties to the custom object<br \/>\n        Write-Debug \"Adding property and value to custom object\"<br \/>\n        $obj | Add-Member -MemberType Noteproperty -name $property.Name -value ($_.($property.name))<\/p>\n<p>     } #end If<br \/>\n} #end ForEach<\/p>\n<p>#Add the typename to the object<br \/>\nWrite-Debug \"Adding typename to custom object\"<br \/>\n$obj | Add-Member -MemberType Noteproperty -Name \"Type\" -Value $typename<\/p>\n<p>#write the custom object to the pipeline<br \/>\nWrite-Debug \"Writing custom object to the pipeline\"<br \/>\nWrite $obj<br \/>\n} #end process<\/p>\n<p>End {<br \/>\n  Write-Verbose \"Ending $($myinvocation.mycommand)\"<br \/>\n }<\/p>\n<p>} #end function<br \/>\n[\/cc]<\/p>\n<p>The function is intended to be used in a pipelined expression and assumes that all the objects are of the same type. The essence of the function is to run each object through Get-Member and keep a list of property names.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nif (-Not $properties) {<br \/>\n    Write-Verbose \"Creating property list\"<br \/>\n    Write-Debug \"Creating property list for pipelined object\"<br \/>\n    $properties=$_ | Get-Member -membertype Properties | sort Name<br \/>\n[\/cc]<\/p>\n<p>Because this happens in the process script block, which runs once for every piped in object, this line only runs if $properties doesn't already exist. If the user includes the -NoSystem parameter, then any property that starts with __ is removed.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nif ($NoSystem) {<br \/>\n        Write-Verbose \"Filtering out WMI System properties\"<br \/>\n        Write-Debug \"Filtering out WMI System properties.\"<br \/>\n        $properties=$properties | where {$_.name -notlike \"__*\"}<br \/>\n    }<br \/>\n[\/cc]<\/p>\n<p> Armed with the array of property names, the pipelined object is checked for each property name. <\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nforeach ($property in $properties) {<br \/>\n    Write-Debug \"Checking $($property.name)\"<br \/>\n     #if object has a value for the current property<br \/>\n     if ($_.($property.name)) {<br \/>\n        Write-Debug \"found value for: $($_.($property.name))\"<br \/>\n[\/cc]<\/p>\n<p>If a value is found<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nif ($_.($property.name))<br \/>\n[\/cc]<\/p>\n<p>Then the property and value are added to the blank custom object which is created for each piped object.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n$obj | Add-Member -MemberType Noteproperty -name $property.Name -value ($_.($property.name))<br \/>\n[\/cc]<\/p>\n<p>I include the object type name and write the custom object to the pipeline.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n#Add the typename to the object<br \/>\nWrite-Debug \"Adding typename to custom object\"<br \/>\n$obj | Add-Member -MemberType Noteproperty -Name \"Type\" -Value $typename<\/p>\n<p>#write the custom object to the pipeline<br \/>\nWrite-Debug \"Writing custom object to the pipeline\"<br \/>\nWrite $obj<br \/>\n[\/cc]<\/p>\n<p>Here's the end result.<\/p>\n<p>[cc lang=\"DOS\"]<br \/>\nBiosCharacteristics  : {4, 7, 8, 9...}<br \/>\nBIOSVersion          : {TOSQCI - 6040000, Ver 1.00PARTTBL}<br \/>\nCaption              : Ver 1.00PARTTBL<br \/>\nDescription          : Ver 1.00PARTTBL<br \/>\nManufacturer         : TOSHIBA<br \/>\nName                 : Ver 1.00PARTTBL<br \/>\nPrimaryBIOS          : True<br \/>\nReleaseDate          : 20101210000000.000000+000<br \/>\nSerialNumber         : Z9131790W<br \/>\nSMBIOSBIOSVersion    : V2.90<br \/>\nSMBIOSMajorVersion   : 2<br \/>\nSMBIOSMinorVersion   : 6<br \/>\nSMBIOSPresent        : True<br \/>\nSoftwareElementID    : Ver 1.00PARTTBL<br \/>\nSoftwareElementState : 3<br \/>\nStatus               : OK<br \/>\nVersion              : TOSQCI - 6040000<br \/>\nType                 : System.Management.ManagementObject#root\\cimv2\\Win32_BIOS<br \/>\n[\/cc]<\/p>\n<p>You probably also noticed the Write-Verbose and Write-Debug lines in the script. Continuing the discussion I started in my post on <a href=\"http:\/\/jdhitsolutions.com\/blog\/2011\/08\/verbose-or-debug\/\" target=\"_blank\">Write-Verbose vs Write-Debug<\/a>, I'm including the suggestion on controlling the debug preference. By default if you the function with -debug you'll get all the debug messages. But if you also use -Inquire, then you'll get prompted for each command which is the normal process when using -Debug. I wanted to see how this would work in one of my own scripts.<\/p>\n<p>As always, I hope you'll let me know how this works out for you. Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/08\/Select-PropertyValue-v2.txt'>Select-PropertyValue<\/a>. The full script includes comment-based help as well as an optional alias. Uncomment the last line of the script if you want to use it or define your own.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s another concept I know I&#8217;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&#8217;s nothing wrong with this approach but depending on the object I might get&#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,317,144,534,540,302],"class_list":["post-1603","post","type-post","status-publish","format-standard","hentry","category-powershell-v2-0","category-scripting","tag-functions","tag-get-member","tag-objects","tag-powershell","tag-scripting","tag-select-object"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Select Object Properties with Values &#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\/1603\/select-object-properties-with-values\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Select Object Properties with Values &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Here&#039;s another concept I know I&#039;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&#039;s nothing wrong with this approach but depending on the object I might get...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-08-16T13:45:04+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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1603\\\/select-object-properties-with-values\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1603\\\/select-object-properties-with-values\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Select Object Properties with Values\",\"datePublished\":\"2011-08-16T13:45:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1603\\\/select-object-properties-with-values\\\/\"},\"wordCount\":853,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"functions\",\"get-member\",\"objects\",\"PowerShell\",\"Scripting\",\"Select-Object\"],\"articleSection\":[\"PowerShell v2.0\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1603\\\/select-object-properties-with-values\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1603\\\/select-object-properties-with-values\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1603\\\/select-object-properties-with-values\\\/\",\"name\":\"Select Object Properties with Values &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2011-08-16T13:45:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1603\\\/select-object-properties-with-values\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1603\\\/select-object-properties-with-values\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1603\\\/select-object-properties-with-values\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell v2.0\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell-v2-0\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Select Object Properties with Values\"}]},{\"@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":"Select Object Properties with Values &#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\/1603\/select-object-properties-with-values\/","og_locale":"en_US","og_type":"article","og_title":"Select Object Properties with Values &#8226; The Lonely Administrator","og_description":"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 the object I might get...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-08-16T13:45:04+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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Select Object Properties with Values","datePublished":"2011-08-16T13:45:04+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/"},"wordCount":853,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["functions","get-member","objects","PowerShell","Scripting","Select-Object"],"articleSection":["PowerShell v2.0","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/","name":"Select Object Properties with Values &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2011-08-16T13:45:04+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell v2.0","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},{"@type":"ListItem","position":2,"name":"Select Object Properties with Values"}]},{"@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":639,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/639\/join-object\/","url_meta":{"origin":1603,"position":0},"title":"Join Object","author":"Jeffery Hicks","date":"May 14, 2010","format":false,"excerpt":"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\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":636,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/636\/select-wmi\/","url_meta":{"origin":1603,"position":1},"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":2241,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2241\/skipping-wmi-system-properties-in-powershell\/","url_meta":{"origin":1603,"position":2},"title":"Skipping WMI System Properties in PowerShell","author":"Jeffery Hicks","date":"April 25, 2012","format":false,"excerpt":"One of my favorite techniques when using WMI in PowerShell is to pipe an object to Select-Object and select all properties. Try this: get-wmiobject win32_bios | select * It works, but it also gets all of the system properties like __PATH which I rarely care about. I also get other\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":1542,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1542\/get-properties-with-values\/","url_meta":{"origin":1603,"position":3},"title":"Get Properties with Values","author":"Jeffery Hicks","date":"July 4, 2011","format":false,"excerpt":"One of my nuisance issues when using WMI with Windows PowerShell, is that when looking at all properties I have to wade though many that have no value. I'd prefer to only view properties that have a populated value. Here's one way. Every WMI object has a property called Properties\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":654,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/654\/new-wmi-object\/","url_meta":{"origin":1603,"position":4},"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":9074,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9074\/the-value-of-objects\/","url_meta":{"origin":1603,"position":5},"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":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1603","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=1603"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1603\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}