{"id":3985,"date":"2014-09-02T09:24:32","date_gmt":"2014-09-02T13:24:32","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=3985"},"modified":"2014-09-02T09:24:32","modified_gmt":"2014-09-02T13:24:32","slug":"powershell-for-the-people-making-the-shell-work-for-you","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/","title":{"rendered":"PowerShell for the People: Making the shell work for you"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/021913_2047_WordTest1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2802\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/021913_2047_WordTest1.png\" alt=\"021913_2047_WordTest1.png\" width=\"144\" height=\"109\" \/><\/a> Once you have some basic PowerShell experience I think you will begin looking for all sorts of ways to use PowerShell. Although one of the biggest obstacles for many IT Pros is the thought of having to type everything. Certainly, PowerShell has a number of features to mitigate this, often misperceived, burden such as tab completion and aliases. It is the latter that I want to discuss today.<\/p>\n<p>An alias is simply an short command name alternative. Instead of typing Get-Process you can type ps. Even I can't screw that up. Using aliases at the command prompt is a great way to speed up your work and cut down on typos. While I wouldn't type this in a script:<\/p>\n<pre class=\"lang:ps decode:true \" >gsv | ? status -eq running<\/pre>\n<p>At a prompt, it is quick and I get the desired results. However, you can't create an alias for a command and its parameters. For example, I love the -First and -Last parameters with Select-Object. But I can't create an alias equivalent to Select-Object -last 10. What you <em>can <\/em>do however, is create your own wrapper around a command and put an alias to that.  Here is a function I wrote for Select-Object -Last X.<\/p>\n<pre class=\"lang:ps decode:true \" >#requires -version 3.0 \r\n\r\nFunction Select-Last {\r\n\r\n&lt;#\r\n.Synopsis\r\nSelect last X number of objects\r\n.Description\r\nThis command takes pipelined input and selects the last specified number of objects which are then written to the pipeline.\r\n\r\nThere is a trade off of convenience for performance. For a very large number processed objects, use Select-Object directly\r\n.Example\r\nPS C:\\&gt; dir c:\\scripts\\*.ps1  | sort lastwritetime | last 5\r\n.Notes\r\nLast Updated: 8\/25\/2014\r\nVersion     : 0.9\r\n\r\n.Link\r\nSelect-Object\r\n#&gt;\r\n\r\n[cmdletbinding()]\r\n\r\nParam(\r\n[Parameter(Position=0,Mandatory,HelpMessage=\"How many objects do you want to get?\")]\r\n[ValidateScript({$_ -gt 0})]\r\n[int]$Last,\r\n[Parameter(Position=1,Mandatory,ValueFromPipeline)]\r\n[object]$InputObject\r\n)\r\n\r\nBegin {\r\n    Write-Verbose -Message \"Starting $($MyInvocation.Mycommand)\"  \r\n    Write-Verbose -Message \"Selecting last $Last objects\"\r\n\r\n    #initialize an array to hold all incoming objects\r\n    $data=@()\r\n    #initialize a counter\r\n    $total=0\r\n    #track when the command started in order to calculate how long the command took to complete.\r\n    $start=Get-Date\r\n} #begin\r\n\r\nProcess {\r\n    $total++\r\n    if ($total -le $Last) {\r\n        #add each piped object to temporary array\r\n        $data+=$InputObject\r\n    }\r\n    else {\r\n      #move all items in the array up one\r\n      $data = $data[1..$Last]\r\n      #add the new item\r\n      $data+=$InputObject\r\n    }\r\n} #process\r\n\r\nEnd {\r\n    #write the results\r\n    $data\r\n    $end = Get-Date\r\n    Write-Verbose -Message \"Processed $total items in $($end-$start)\"\r\n    Write-Verbose -Message \"Ending $($MyInvocation.Mycommand)\"\r\n} #end\r\n}\r\n\r\nSet-Alias -Name Last -Value Select-Last<\/pre>\n<p>You'll notice that the last part of my code snippet is defining an alias called Last that references this function. But now I have something quick and easy to use at a PowerShell prompt.<\/p>\n<pre class=\"lang:ps decode:true \" >dir c:\\work\\*.txt | sort lastwritetime | last 5<\/pre>\n<p>You'll have to figure out the best way to wrap the cmdlet. In this case, I am taking each piped in object and adding it to an array, only keeping the specified number of items. As each item is added, the other items are moved \"up\" in the array.<\/p>\n<p>Be aware that there may be a trade-off between convenience and performance. This command using my alias and custom function:<\/p>\n<pre class=\"lang:ps decode:true \" >Measure-command {1..5000 | last 3}<\/pre>\n<p>took 237ms. Whereas the Select-Object approach:<\/p>\n<pre class=\"lang:ps decode:true \" >Measure-command {1..5000 | select -Last 3}<\/pre>\n<p>Only took 49ms. But I bet you might be willing to accept that tradeoff to save some typing. Of course, if there is a Last command there should be a First command.<\/p>\n<pre class=\"lang:ps decode:true \" >Function Select-First {\r\n&lt;#\r\n.Synopsis\r\nSelect first X number of objects\r\n.Description\r\nThis command takes pipelined input and selects the first specified number of objects which are then written to the pipeline.\r\n.Example\r\nPS C:\\&gt; get-process | sort WS -descending | first 5\r\n.Notes\r\nLast Updated: 8\/25\/2014\r\nVersion     : 0.9\r\n\r\n.Link\r\nSelect-Object\r\n#&gt;\r\n[cmdletbinding()]\r\n\r\nParam(\r\n[Parameter(Position=0,Mandatory,HelpMessage=\"How many objects do you want to get?\")]\r\n[ValidateScript({$_ -gt 0})]\r\n[int]$First,\r\n[Parameter(Position=1,Mandatory,ValueFromPipeline)]\r\n[object]$InputObject\r\n)\r\n\r\nBegin {\r\n    Write-Verbose -Message \"Starting $($MyInvocation.Mycommand)\"  \r\n    Write-Verbose -Message \"Selecting first $First objects\"\r\n    #track when the command started in order to calculate how long the command took to complete.\r\n    $start=Get-Date\r\n    #initialize a counter\r\n    $i=0\r\n} #begin\r\n\r\nProcess {\r\n    #add each piped object to temporary array\r\n    $i++\r\n   \r\n    if ($i -le $First) {    \r\n        $InputObject\r\n    }\r\n    else {\r\n        #we're done here\r\n        Write-Verbose \"Limit reached\"\r\n        $end = Get-Date\r\n        Write-Verbose -Message \"Processed $($data.count) items in $($end-$start)\"\r\n        Write-Verbose -Message \"Ending $($MyInvocation.Mycommand)\"\r\n        #bail out\r\n        break\r\n    }\r\n} #process\r\n\r\nEnd {\r\n    #not used    \r\n} #end\r\n}\r\n\r\nSet-Alias -Name First -Value Select-First<\/pre>\n<p>Performance-wise this is easier because all I have to do is count piped in objects and bail out once I reach the limit.<\/p>\n<pre class=\"lang:ps decode:true \" >ps | sort ws -des | first 3<\/pre>\n<p>In this example I'm not only taking advantage of aliases, but also positional parameters and only having to type enough the of the parameter name so PowerShell knows what I want.<\/p>\n<p>So there are ways to make PowerShell more keyboard friendly, although it might take a little work on your part. Next time we'll look at another alternative.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once you have some basic PowerShell experience I think you will begin looking for all sorts of ways to use PowerShell. Although one of the biggest obstacles for many IT Pros is the thought of having to type everything. Certainly, PowerShell has a number of features to mitigate this, often misperceived, burden such as tab&#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 from the blog - #PowerShell for the People: Making the shell work for you http:\/\/wp.me\/p1nF6U-12h","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,8],"tags":[160,534,540,302],"class_list":["post-3985","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-alias","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>PowerShell for the People: Making the shell work for you &#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\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PowerShell for the People: Making the shell work for you &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Once you have some basic PowerShell experience I think you will begin looking for all sorts of ways to use PowerShell. Although one of the biggest obstacles for many IT Pros is the thought of having to type everything. Certainly, PowerShell has a number of features to mitigate this, often misperceived, burden such as tab...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2014-09-02T13:24:32+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/021913_2047_WordTest1.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\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"PowerShell for the People: Making the shell work for you\",\"datePublished\":\"2014-09-02T13:24:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/\"},\"wordCount\":433,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/021913_2047_WordTest1.png\",\"keywords\":[\"Alias\",\"PowerShell\",\"Scripting\",\"Select-Object\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/\",\"name\":\"PowerShell for the People: Making the shell work for you &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/021913_2047_WordTest1.png\",\"datePublished\":\"2014-09-02T13:24:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/021913_2047_WordTest1.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/021913_2047_WordTest1.png\",\"width\":144,\"height\":109},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3985\\\/powershell-for-the-people-making-the-shell-work-for-you\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PowerShell for the People: Making the shell work for you\"}]},{\"@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":"PowerShell for the People: Making the shell work for you &#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\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/","og_locale":"en_US","og_type":"article","og_title":"PowerShell for the People: Making the shell work for you &#8226; The Lonely Administrator","og_description":"Once you have some basic PowerShell experience I think you will begin looking for all sorts of ways to use PowerShell. Although one of the biggest obstacles for many IT Pros is the thought of having to type everything. Certainly, PowerShell has a number of features to mitigate this, often misperceived, burden such as tab...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/","og_site_name":"The Lonely Administrator","article_published_time":"2014-09-02T13:24:32+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/021913_2047_WordTest1.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\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"PowerShell for the People: Making the shell work for you","datePublished":"2014-09-02T13:24:32+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/"},"wordCount":433,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/021913_2047_WordTest1.png","keywords":["Alias","PowerShell","Scripting","Select-Object"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/","name":"PowerShell for the People: Making the shell work for you &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/021913_2047_WordTest1.png","datePublished":"2014-09-02T13:24:32+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/021913_2047_WordTest1.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/021913_2047_WordTest1.png","width":144,"height":109},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3985\/powershell-for-the-people-making-the-shell-work-for-you\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"PowerShell for the People: Making the shell work for you"}]},{"@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":1330,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/1330\/powershell-ise-convert-all-aliases\/","url_meta":{"origin":3985,"position":0},"title":"PowerShell ISE Convert All Aliases","author":"Jeffery Hicks","date":"April 8, 2011","format":false,"excerpt":"Yesterday I posted an article on how to convert a selected word to an alias or cmdlet. While I think there is still some value in this piecemeal approach. sometimes you want to make wholesale changes, such as when troubleshooting a script that someone else wrote that is full of\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":7648,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7648\/updated-powershell-tools\/","url_meta":{"origin":3985,"position":1},"title":"Updated PowerShell Tools","author":"Jeffery Hicks","date":"August 14, 2020","format":false,"excerpt":"I've released a new version of my popular PSScriptTools module, which you can install from the PowerShell Gallery. The module is collection of commands and tools that I use in my scripting and day-to-day work at a PowerShell console. Many of the commands run in Windows PowerShell and PowerShell 7,\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\/08\/get-myalias-2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/get-myalias-2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/get-myalias-2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/get-myalias-2.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/get-myalias-2.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/get-myalias-2.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1340,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1340\/convert-aliases-with-the-tokenizer\/","url_meta":{"origin":3985,"position":2},"title":"Convert Aliases with the Tokenizer","author":"Jeffery Hicks","date":"April 12, 2011","format":false,"excerpt":"Last week I posted a function you can use in the Windows PowerShell ISE to convert aliases to command definitions. My script relied on regular expressions to seek out and replace aliases. A number of people asked me why I didn't use the PowerShell tokenizer. My answer was that because\u2026","rel":"","context":"In &quot;PowerShell ISE&quot;","block_context":{"text":"PowerShell ISE","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-ise\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3679,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3679\/get-powershell-parameter-aliases\/","url_meta":{"origin":3985,"position":3},"title":"Get PowerShell Parameter Aliases","author":"Jeffery Hicks","date":"February 12, 2014","format":false,"excerpt":"During a recent PowerShell training class we naturally covered aliases. An alias is simply an alternate name, often something that is shorter to type, or maybe even more meaningful. There are aliases for commands, properties and parameters. Discovering aliases for commands is pretty easy with Get-Alias. Property aliases are discoverable\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"magnifying-glass","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/magnifying-glass-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":8793,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-7\/8793\/profile-powershell-functions\/","url_meta":{"origin":3985,"position":4},"title":"Profile PowerShell Functions","author":"Jeffery Hicks","date":"January 17, 2022","format":false,"excerpt":"I've published a stable release of the PSFunctionTools module to the PowerShell Gallery. Previously, it was pre-release. The module requires PowerShell 7.1 and later. Although, as I have mentioned in the past, you are welcome to fork the repository and create a version that will run on Windows PowerShell. I\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\/get-functionprofile2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/get-functionprofile2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/get-functionprofile2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/01\/get-functionprofile2.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":579,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/579\/powershell-picasso\/","url_meta":{"origin":3985,"position":5},"title":"PowerShell Picasso","author":"Jeffery Hicks","date":"February 23, 2010","format":false,"excerpt":"You have probably heard the story (or legend) about Pablo Picasso and his napkin drawing. A guy goes up to Picasso in a cafe and asks for an autograph or something. Picasso sketches out something in a minute or so. He turns to the guy and says, \u201cThat will be\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":"powershell--picasso","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/02\/powershellpicasso_thumb.jpg?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3985","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=3985"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3985\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}