{"id":8798,"date":"2022-01-18T10:20:36","date_gmt":"2022-01-18T15:20:36","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=8798"},"modified":"2022-01-18T10:20:40","modified_gmt":"2022-01-18T15:20:40","slug":"tell-powershell-what-you-want","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/","title":{"rendered":"Tell PowerShell What You Want"},"content":{"rendered":"\n<p>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 even if you don't use Hyper-V, the concepts are equally valid should you need to customize the output from a different PowerShell command.<\/p>\n\n\n\n<p>PowerShell is all about objects, which is a good thing. Fortunately for us, the PowerShell team planned ahead and didn't create commands that emitted fixed objects. They gave us the tools to customize the output to meet our needs. That is the case here.<\/p>\n\n\n\n<p>You typically get an easy-to-read result when you run a cmdlet in PowerShell, especially one from Microsoft. When the command was being developed, someone decided what information to display and how to display it. Many commands, like Get-VM, write a rich object to the pipeline. However, you only see a subset of that information. It is easy to see all available properties using Select-Object.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties.png\"><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"406\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties.png\" alt=\"view object properties\" class=\"wp-image-8799\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties.png 735w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties-300x166.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/a><\/figure>\n\n\n\n<p>If I want to view something, all I have to do is tell PowerShell to show it to me.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Get-VM | Where-Object state -EQ running | \nSelect-Object -Property Name, State, Version, Uptime, AutomaticStartAction, Notes<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/select-properties.png\"><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"480\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/select-properties.png\" alt=\"select object properties\" class=\"wp-image-8800\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/select-properties.png 727w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/select-properties-300x198.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/select-properties-350x230.png 350w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/a><\/figure>\n\n\n\n<p>But let's suppose I want to get these properties frequently. It will become pretty tedious to keep re-typing the Select-Object statement. Here is one option.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Property Sets<\/h2>\n\n\n\n<p>PowerShell has a concept of property sets. A property set allows you to use a single property name to retrieve a group of properties. Some of these sets are defined by default. To see for yourself, run this command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Get-Process | Select-Object PSResources<\/code><\/pre>\n\n\n\n<p>You'll get a group of related properties. In the case of the virtual machine, it would be nice to have a property set that includes Notes property. But there's a slight catch. You use Update-TypeData to extend objects. But a property set requires a specially formatted ps1xml file. Don't panic. I got your back.<\/p>\n\n\n\n<p>Install the <a href=\"https:\/\/github.com\/jdhitsolutions\/PSTypeExtensionTools\" target=\"_blank\" rel=\"noreferrer noopener\">PSTypeExtensionTools<\/a> module from the PowerShell Gallery. I've written a command that will generate the XML file for you.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$splat = @{\n    Typename   = 'Microsoft.HyperV.PowerShell.VirtualMachine'\n    Name       = 'MgmtInfo'\n    FilePath   = 'C:\\scripts\\mgmtinfo.types.ps1xml'\n    Properties = 'Name', 'State', 'Version', 'Uptime', 'AutomaticStartAction', 'Notes'\n}\nNew-PSPropertySet @splat<\/code><\/pre>\n\n\n\n<p>The Typename value is what you see when piping an object to Get-Member. The Name value will be the name of the new property set. The path is self-explanatory. The typical naming convention is objectType.types.ps1xml. I deviated slightly. And, of course, the properties are the members of the new set.<\/p>\n\n\n\n<p>Running this command generates this XML file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"xml\" class=\"language-xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?>\n&lt;!--\nThis file was created with New-PSPropertySet from the\nPSTypeExtensionTools module which you can install from\nthe PowerShell Gallery.\n\nUse Update-TypeData to append this file in your PowerShell session.\n\nCreated 01\/18\/2022 08:33:05\n-->\n&lt;Types>\n  &lt;Type>\n    &lt;Name>Microsoft.HyperV.PowerShell.VirtualMachine&lt;\/Name>\n    &lt;Members>\n      &lt;PropertySet>\n        &lt;Name>MgmtInfo&lt;\/Name>\n        &lt;ReferencedProperties>\n          &lt;Name>Name&lt;\/Name>\n          &lt;Name>State&lt;\/Name>\n          &lt;Name>Version&lt;\/Name>\n          &lt;Name>Uptime&lt;\/Name>\n          &lt;Name>AutomaticStartAction&lt;\/Name>\n          &lt;Name>Notes&lt;\/Name>\n        &lt;\/ReferencedProperties>\n      &lt;\/PropertySet>\n    &lt;\/Members>\n  &lt;\/Type>\n&lt;\/Types><\/code><\/pre>\n\n\n\n<p>To use this in my PowerShell session, I need to import it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Update-TypeData -AppendPath $splat.FilePath<\/code><\/pre>\n\n\n\n<p>I now have a new property.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-propertyset.png\"><img loading=\"lazy\" decoding=\"async\" width=\"760\" height=\"319\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-propertyset.png\" alt=\"new property set\" class=\"wp-image-8801\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-propertyset.png 760w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-propertyset-300x126.png 300w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><\/a><\/figure>\n\n\n\n<p>You must separate the idea of what to display from how to display it. Formatting is a separate task.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/formatted-propertyset.png\"><img loading=\"lazy\" decoding=\"async\" width=\"908\" height=\"346\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/formatted-propertyset.png\" alt=\"formatted property set\" class=\"wp-image-8802\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/formatted-propertyset.png 908w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/formatted-propertyset-300x114.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/formatted-propertyset-768x293.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/formatted-propertyset-850x324.png 850w\" sizes=\"auto, (max-width: 908px) 100vw, 908px\" \/><\/a><\/figure>\n\n\n\n<p>The property set is no different than any other property. I could just as easily run a command like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Get-VM | Where-Object state -EQ running | \nSelect-Object -Property MgmtInfo | Out-GridView<\/code><\/pre>\n\n\n\n<p><br>By the way, this property set is only defined for the duration of my PowerShell session. If this is something I want all the time, I would add the Update-TypeData command to my PowerShell profile script.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Changing the Defaults<\/h2>\n\n\n\n<p>Technically, you can use Update-TypeData to change the default property set. Use Get-TypeData to discover.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/typedata.png\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"338\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/typedata.png\" alt=\"default property set\" class=\"wp-image-8803\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/typedata.png 693w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/typedata-300x146.png 300w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/a><\/figure>\n\n\n\n<p>However, this list of default properties doesn't necessarily mean this is what you see.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/default-vm-view.png\"><img loading=\"lazy\" decoding=\"async\" width=\"752\" height=\"108\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/default-vm-view.png\" alt=\"default VM view\" class=\"wp-image-8804\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/default-vm-view.png 752w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/default-vm-view-300x43.png 300w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/a><\/figure>\n\n\n\n<p>The default output for Get-VM is a formatted table. See the distinction between what to display and how it should be displayed?<\/p>\n\n\n\n<p>I can update the DefaultDisplayPropertySet easily enough.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/modified-defaultdisplay.png\"><img loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"339\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/modified-defaultdisplay.png\" alt=\"modified default display\" class=\"wp-image-8805\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/modified-defaultdisplay.png 737w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/modified-defaultdisplay-300x138.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/a><\/figure>\n\n\n\n<p>The default table view doesn't have a definition for the Notes property, so I don't see it. But I can fix that, too.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Custom Format File<\/h2>\n\n\n\n<p>I've written about this step several times. The easiest step is to create a custom formatted view using the New-PSFormatXML command from the <a href=\"https:\/\/github.com\/jdhitsolutions\/PSScriptTools\/\" target=\"_blank\" rel=\"noreferrer noopener\">PSScriptTools<\/a> module. I'll assume the desired result is the current view with the addition of the Notes property.<\/p>\n\n\n\n<p>To use the command, you need a sample object with a value for all the properties you want to use.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$splat = @{\n Path = 'c:\\scripts\\vmnotes.format.ps1xml' \n ViewName = 'notes'\n Wrap = $true\n Properties = 'Name','State','CpuUsage','MemoryAssigned',\n 'Uptime',@{Name='Version';Expression={$_.status}},'Notes'\n}\n\nGet-VM dom1 | New-PSFormatXML @splat<\/code><\/pre>\n\n\n\n<p>I'm going to create a new table view called 'notes.' I'll point out that as I was writing this I discovered a minor bug in New-PSFormatXML. If you run this code you might get an error that CpuUsage is a read-only property. This won't affect the result, and you can ignore the error. I'll have to look into this later.<\/p>\n\n\n\n<p>Like the types ps1xml file, you need to update PowerShell to use the new format.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Update-FormatData $splat.path<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-formatview.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1014\" height=\"319\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-formatview.png\" alt=\"new formatted view\" class=\"wp-image-8806\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-formatview.png 1014w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-formatview-300x94.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-formatview-768x242.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/new-formatview-850x267.png 850w\" sizes=\"auto, (max-width: 1014px) 100vw, 1014px\" \/><\/a><\/figure>\n\n\n\n<p>You'll notice that some of the data is a bit raw, like the MemoryAssigned values. Notes in the XML file show you how to customize and format the output.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>When it comes to extending PowerShell, there are several approaches you can take. It ultimately comes down to how you intend to consume the information. Do you need a custom property set to simplify your PowerShell command? Or do you need a formatted result with the desired information? Hopefully, this will get my friend on track.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;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 even if you don&#8217;t use&#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 on the blog: Tell #PowerShell What You Want","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],"tags":[282,534,283],"class_list":["post-8798","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-formatdata","tag-powershell","tag-typedata"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Tell PowerShell What You Want &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"Some tips and suggestions on extending PowerShell objects and view to get the information you want in the form you want it.\" \/>\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\/8798\/tell-powershell-what-you-want\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tell PowerShell What You Want &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Some tips and suggestions on extending PowerShell objects and view to get the information you want in the form you want it.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-18T15:20:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-18T15:20:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties.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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Tell PowerShell What You Want\",\"datePublished\":\"2022-01-18T15:20:36+00:00\",\"dateModified\":\"2022-01-18T15:20:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/\"},\"wordCount\":827,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/vm-properties.png\",\"keywords\":[\"FormatData\",\"PowerShell\",\"TypeData\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/\",\"name\":\"Tell PowerShell What You Want &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/vm-properties.png\",\"datePublished\":\"2022-01-18T15:20:36+00:00\",\"dateModified\":\"2022-01-18T15:20:40+00:00\",\"description\":\"Some tips and suggestions on extending PowerShell objects and view to get the information you want in the form you want it.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/vm-properties.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/vm-properties.png\",\"width\":735,\"height\":406},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8798\\\/tell-powershell-what-you-want\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tell PowerShell What You Want\"}]},{\"@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":"Tell PowerShell What You Want &#8226; The Lonely Administrator","description":"Some tips and suggestions on extending PowerShell objects and view to get the information you want in the form you want it.","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\/8798\/tell-powershell-what-you-want\/","og_locale":"en_US","og_type":"article","og_title":"Tell PowerShell What You Want &#8226; The Lonely Administrator","og_description":"Some tips and suggestions on extending PowerShell objects and view to get the information you want in the form you want it.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/","og_site_name":"The Lonely Administrator","article_published_time":"2022-01-18T15:20:36+00:00","article_modified_time":"2022-01-18T15:20:40+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Tell PowerShell What You Want","datePublished":"2022-01-18T15:20:36+00:00","dateModified":"2022-01-18T15:20:40+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/"},"wordCount":827,"commentCount":3,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties.png","keywords":["FormatData","PowerShell","TypeData"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/","name":"Tell PowerShell What You Want &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties.png","datePublished":"2022-01-18T15:20:36+00:00","dateModified":"2022-01-18T15:20:40+00:00","description":"Some tips and suggestions on extending PowerShell objects and view to get the information you want in the form you want it.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/vm-properties.png","width":735,"height":406},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8798\/tell-powershell-what-you-want\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Tell PowerShell What You Want"}]},{"@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":7604,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7604\/discovering-provider-specific-commands\/","url_meta":{"origin":8798,"position":0},"title":"Discovering Provider Specific Commands","author":"Jeffery Hicks","date":"July 22, 2020","format":false,"excerpt":"I've been diving into PowerShell help lately while preparing my next Pluralsight course. One of the sad things I have discovered is the loss of provider-aware help. As you may know, some commands have parameters that only exist when using a specific PSDrive.\u00a0 For example, the -File parameter for Get-ChildItem\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\/2020\/07\/gsyn-2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/gsyn-2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/gsyn-2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/gsyn-2.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":3121,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3121\/browsing-powershell-commands\/","url_meta":{"origin":8798,"position":1},"title":"Browsing PowerShell Commands","author":"Jeffery Hicks","date":"June 25, 2013","format":false,"excerpt":"Whenever I'm exploring a new PowerShell module or snapin, one of the first things I do is list all of the commands found within the module. PS C:\\scripts> get-command -module psworkflow CommandType Name ModuleName ----------- ---- ---------- Function New-PSWorkflowSession PSWorkflow Cmdlet New-PSWorkflowExecutionOption PSWorkflow You can specify either a module or\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"get-command-mod","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/06\/get-command-mod-1024x670.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/06\/get-command-mod-1024x670.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/06\/get-command-mod-1024x670.png?resize=525%2C300 1.5x"},"classes":[]},{"id":2962,"url":"https:\/\/jdhitsolutions.com\/blog\/friday-fun\/2962\/friday-fun-powershell-commands-by-noun\/","url_meta":{"origin":8798,"position":2},"title":"Friday Fun PowerShell Commands by Noun","author":"Jeffery Hicks","date":"April 19, 2013","format":false,"excerpt":"One of PowerShell's greatest strength's is discoverability. Once you know how, it is very easy to discover what \u00a0you can do with PowerShell and how. One reason this works is because PowerShell commands follow a consistent verb-noun naming convention. With this in mind, you can see all of the commands\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"get-command-noun-01","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-command-noun-01-1024x577.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-command-noun-01-1024x577.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-command-noun-01-1024x577.png?resize=525%2C300 1.5x"},"classes":[]},{"id":840,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/","url_meta":{"origin":8798,"position":3},"title":"Pipelines, Consoles and Hosts","author":"Jeffery Hicks","date":"August 19, 2010","format":false,"excerpt":"I continue to come across a particular topic in discussion forums that causes many PowerShell beginners a lot of headaches and more than a little frustration. I know I've written about this before and I'm sure I'll cover it again, but when writing anything in PowerShell that you see in\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\/2010\/08\/write-demo.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":5641,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/","url_meta":{"origin":8798,"position":4},"title":"PowerShell Pop Quiz","author":"Jeffery Hicks","date":"September 13, 2017","format":false,"excerpt":"I'm always looking for ways to help teach PowerShell and the other day I thought why not have PowerShell teach you itself? I have created a PowerShell script that dynamically generates a quiz on cmdlets and functions installed on your computer. In short the quiz question shows you a command\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png?resize=700%2C400 2x"},"classes":[]},{"id":35,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/35\/printing-from-powershell\/","url_meta":{"origin":8798,"position":5},"title":"Printing from PowerShell","author":"Jeffery Hicks","date":"June 6, 2006","format":false,"excerpt":"PowerShell has a slick feature that allows you to send the output from a cmdlet or expression directly to a printer. Pipe the output to the Out-Printer cmdlet and it will print out on the default printer:get-process | out-printer If you have other printers installed you can use the printer\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":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8798","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=8798"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8798\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}