{"id":5702,"date":"2017-10-26T10:33:13","date_gmt":"2017-10-26T14:33:13","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=5702"},"modified":"2017-10-26T10:33:13","modified_gmt":"2017-10-26T14:33:13","slug":"are-you-my-type","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/","title":{"rendered":"Are You My Type?"},"content":{"rendered":"<p>I am always stressing that PowerShell is all about the objects. If you keep this in mind, PowerShell is pretty easy to use. Get a bunch of things, and select the details that you want to see or work with. Out of the box PowerShell gives you some very rich objects to work with from simple files to Active Directory users. What I like even more is that you can create your own properties \"on-the-fly\" to meet <em>your<\/em> needs. It is almost like magic. You can create new properties practically out of thin air. But sometimes even this process can get a bit tedious or overwhelming. Let me offer some solutions.<\/p>\n<p><!--more--><\/p>\n<p>Let's begin a PowerShell expression you might run to discover what system drivers are currently running.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Get-CimInstance -class win32_systemdriver -filter \"state='running'\" |\r\nSelect-Object Name,Description,ServiceType,StartMode,@{Name=\"Path\";Expression={$_.pathname}},\r\n@{Name=\"Company\";Expression = {(get-item $_.pathname).versioninfo.CompanyName}},\r\n@{Name=\"Product\";Expression = {(get-item $_.pathname).versioninfo.ProductName}},\r\n@{Name=\"Version\";Expression = {(get-item $_.pathname).versioninfo.productversion}},\r\n@{Name=\"Updated\";Expression = {(get-item $_.pathname).lastwritetime}},\r\n@{Name=\"Computername\";Expression={$_.SystemName}}\r\n<\/pre>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-3.png\" alt=\"image\" width=\"1028\" height=\"559\" border=\"0\" \/><\/a><\/p>\n<p>Effective, although, this is a lot of typing. With <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113387\" target=\"_blank\" rel=\"noopener\">Select-Object<\/a> I created a few alias properties using hashtables. For example, instead of using 'SystemName,' I wanted to display 'Computername'. I also wanted to include information that wasn't a part of the Win32_SystemDriver object. The object did include a property for the file path, so I create a few custom properties that retrieved version information from the file.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">@{Name=\"Company\";Expression = {(get-item $_.pathname).versioninfo.CompanyName}},\r\n@{Name=\"Product\";Expression = {(get-item $_.pathname).versioninfo.ProductName}},\r\n@{Name=\"Version\";Expression = {(get-item $_.pathname).versioninfo.productversion}}\r\n<\/pre>\n<p>The challenge is that if I want to re-run the command perhaps with a different filter or a different subset of properties, I have to re-type a lot of code. I'm betting you don't like to type.\u00a0 Let's look at some options.<\/p>\n<p>First, you could save your custom property definitions as variables.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">$path = @{Name=\"Path\";Expression={$_.pathname}}\r\n$company = @{Name=\"Company\";Expression = {(get-item $_.pathname).versioninfo.CompanyName}}\r\n<\/pre>\n<p>I can use these variables in my Select-Object statement.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Get-CimInstance -class win32_systemdriver -filter \"state='running'\" | \r\nSelect-Object Name,Description,StartMode,$path,$company  | Group Company\r\n<\/pre>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-4.png\" alt=\"image\" width=\"1028\" height=\"559\" border=\"0\" \/><\/a><\/p>\n<p>As long as I have these variables defined I can use them as often as I want.<\/p>\n<p>But perhaps the best approach is to create you own type extension. Before you run away thinking I'm asking you to create an arcane looking xml file, this is actually quite easy. First, you need typename of the object you want to extend. You see this every time you use <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113322\" target=\"_blank\" rel=\"noopener\">Get-Member<\/a>.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-5.png\" alt=\"image\" width=\"1028\" height=\"559\" border=\"0\" \/><\/a><\/p>\n<p>I'm going to save this value with a line of code.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">$type = get-ciminstance win32_systemdriver | select-object -first 1 | Get-member | Select-object -ExpandProperty TypeName\r\n<\/pre>\n<p>More than likely this variable will be an array of names so I'll use $type[0]<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-6.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-6.png\" alt=\"image\" width=\"1028\" height=\"156\" border=\"0\" \/><\/a><\/p>\n<p>Next, I'm going to use the <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113421\" target=\"_blank\" rel=\"noopener\">Update-TypeData<\/a> cmdlet. Yes, you can use a ps1xml file but you don't have to.\u00a0 I can just easily create my alias properties.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Update-TypeData -TypeName $type[0] -MemberType AliasProperty -MemberName Path -Value pathname -force\r\nUpdate-TypeData -TypeName $type[0] -MemberType AliasProperty -MemberName Computername -Value SystemName -force\r\n<\/pre>\n<p>The Value is the name of the actual property. I'm using \u2013Force to overwrite any existing property definitions. I can also create ScriptProperties which will run a small bit of code to get a value.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Update-TypeData -TypeName $type[0] -MemberType ScriptProperty -MemberName Company -Value {(get-item $this.pathname).versioninfo.CompanyName} -force\r\nUpdate-TypeData -TypeName $type[0] -MemberType ScriptProperty -MemberName \"Product\" -Value {(get-item $this.pathname).versioninfo.ProductName} -force\r\nUpdate-TypeData -TypeName $type[0] -MemberType ScriptProperty -MemberName \"Version\" -Value {(get-item $this.pathname).versioninfo.productversion} -force\r\nUpdate-TypeData -TypeName $type[0] -MemberType ScriptProperty -MemberName \"Updated\" -Value {(get-item $this.pathname).lastwritetime} -force\r\n<\/pre>\n<p>The Value is the scriptblock portion of the Expression key I defined early. The only other change you must remember to make is to use $this instead $_.<\/p>\n<p>Now, these properties are defined for any Win32_SystemDriver object.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Get-CimInstance Win32_SystemDriver -filter \"state='running'\"  | \r\nSelect-Object Name,Description,ServiceType,StartMode,Path,Company,Product,Version,Updated,Computername |\r\nOut-Gridview -title \"Running Drivers\"\r\n<\/pre>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-7.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-7.png\" alt=\"image\" width=\"1028\" height=\"391\" border=\"0\" \/><\/a><\/p>\n<p>See how much easier and cleaner that is? I can use these properties as much as I want.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Get-CimInstance Win32_SystemDriver -filter \"servicetype='kernel driver'\"  |\r\nWhere Company -notmatch \"microsoft\" | Sort StartMode,Name |\r\nFormat-Table -GroupBy StartMode -Property State,Name,Company\r\n<\/pre>\n<p>However, remember that these are *your* properties and not part of WMI which is why I can't use them in the <a title=\"read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=287299\" target=\"_blank\" rel=\"noopener\">Get-CimInstance<\/a> filter.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-8.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-8.png\" alt=\"image\" width=\"996\" height=\"772\" border=\"0\" \/><\/a><\/p>\n<p>A few final caveats on this technique. These extensions will only last for as long as my PowerShell session is running. If I always want to have them, I would put this code in my PowerShell profile script. You should also be careful when writing scripts or modules that use these extensions. If someone is running your code and they haven't added the type extensions the code won't work. In a module, you can add the Update-TypeData lines into your .psm1 file. Or you can take the extra steps to create an actual .ps1xml file with the extensions and include that with your module.<\/p>\n<p>Give my code samples a spin and let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am always stressing that PowerShell is all about the objects. If you keep this in mind, PowerShell is pretty easy to use. Get a bunch of things, and select the details that you want to see or work with. Out of the box PowerShell gives you some very rich objects to work with from&#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":"New #PowerShell content on the blog: Are You My Type?","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,19],"tags":[387,534,283],"class_list":["post-5702","post","type-post","status-publish","format-standard","hentry","category-powershell","category-wmi","tag-cim","tag-powershell","tag-typedata"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Are You My Type? &#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\/powershell\/5702\/are-you-my-type\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Are You My Type? &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I am always stressing that PowerShell is all about the objects. If you keep this in mind, PowerShell is pretty easy to use. Get a bunch of things, and select the details that you want to see or work with. Out of the box PowerShell gives you some very rich objects to work with from...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2017-10-26T14:33:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-3.png\" \/>\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\\\/powershell\\\/5702\\\/are-you-my-type\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Are You My Type?\",\"datePublished\":\"2017-10-26T14:33:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/\"},\"wordCount\":628,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/image_thumb-3.png\",\"keywords\":[\"CIM\",\"PowerShell\",\"TypeData\"],\"articleSection\":[\"PowerShell\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/\",\"name\":\"Are You My Type? &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/image_thumb-3.png\",\"datePublished\":\"2017-10-26T14:33:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/image_thumb-3.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/image_thumb-3.png\",\"width\":1028,\"height\":559},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5702\\\/are-you-my-type\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Are You My Type?\"}]},{\"@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":"Are You My Type? &#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\/powershell\/5702\/are-you-my-type\/","og_locale":"en_US","og_type":"article","og_title":"Are You My Type? &#8226; The Lonely Administrator","og_description":"I am always stressing that PowerShell is all about the objects. If you keep this in mind, PowerShell is pretty easy to use. Get a bunch of things, and select the details that you want to see or work with. Out of the box PowerShell gives you some very rich objects to work with from...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/","og_site_name":"The Lonely Administrator","article_published_time":"2017-10-26T14:33:13+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-3.png","type":"","width":"","height":""}],"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\/powershell\/5702\/are-you-my-type\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Are You My Type?","datePublished":"2017-10-26T14:33:13+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/"},"wordCount":628,"commentCount":2,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-3.png","keywords":["CIM","PowerShell","TypeData"],"articleSection":["PowerShell","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/","name":"Are You My Type? &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-3.png","datePublished":"2017-10-26T14:33:13+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-3.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image_thumb-3.png","width":1028,"height":559},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5702\/are-you-my-type\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Are You My Type?"}]},{"@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":8798,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/","url_meta":{"origin":5702,"position":0},"title":"Tell PowerShell What You Want","author":"Jeffery Hicks","date":"January 18, 2022","format":false,"excerpt":"I saw a question on Twitter the other day about how to include the Notes property when running the Get-VM Hyper-V cmdlet. I'm reading between the lines, but I think the desired goal was to include the Notes property. Here are a few ways you might tackle this problem. And\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\/01\/new-formatview.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-formatview.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-formatview.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-formatview.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":9074,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9074\/the-value-of-objects\/","url_meta":{"origin":5702,"position":1},"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":1542,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1542\/get-properties-with-values\/","url_meta":{"origin":5702,"position":2},"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":3073,"url":"https:\/\/jdhitsolutions.com\/blog\/friday-fun\/3073\/friday-fun-view-objects-in-a-powershell-gridlist\/","url_meta":{"origin":5702,"position":3},"title":"Friday Fun: View Objects in a PowerShell GridList","author":"Jeffery Hicks","date":"May 24, 2013","format":false,"excerpt":"One of the things that makes PowerShell easy to learn is discoverability. Want to know more about a particular type of object? Pipe it to Get-Member. Or if you want to see values pipe it to Select-Object. get-ciminstance win32_computersystem | select * That's not too bad. Or you can pipe\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"Select-OutGridView","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/05\/Select-OutGridView-300x72.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6612,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6612\/more-fun-with-docker-containers-and-powershell\/","url_meta":{"origin":5702,"position":4},"title":"More Fun with Docker Containers and PowerShell","author":"Jeffery Hicks","date":"March 29, 2019","format":false,"excerpt":"A few days ago I shared some experiences of working with Docker containers and PowerShell. As I continue to learn Docker, I am also learning how to manage it with PowerShell. The Docker command line tools are fine but I think they are even better when drizzled with a nice\u2026","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/jdhitsolutions.com\/blog\/category\/docker\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/03\/image_thumb-20.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/03\/image_thumb-20.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/03\/image_thumb-20.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/03\/image_thumb-20.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2410,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2410\/find-required-services-with-powershell\/","url_meta":{"origin":5702,"position":5},"title":"Find Required Services with PowerShell","author":"Jeffery Hicks","date":"June 27, 2012","format":false,"excerpt":"Here's a little PowerShell tidbit to get the status of all the required services. That is, the services that other services depend upon. When using Get-Service, this is the RequiredServices property which will be a collection of service objects. get-service | where {$_.status -eq \"running\"} | select -expand RequiredServices I'm\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\/2011\/10\/talkbubble-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5702","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=5702"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5702\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}