{"id":120995,"date":"2020-11-26T18:00:38","date_gmt":"2020-11-26T15:00:38","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/whats-coming-in-powershell-7-1-cloudsavvy-it\/"},"modified":"2020-11-26T18:00:38","modified_gmt":"2020-11-26T15:00:38","slug":"whats-coming-in-powershell-7-1-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/whats-coming-in-powershell-7-1-cloudsavvy-it\/","title":{"rendered":"#What\u2019s Coming in PowerShell 7.1 \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2d9fc370bc4\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2d9fc370bc4\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-coming-in-powershell-7-1-cloudsavvy-it\/#Architectural_Changes\" >Architectural Changes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-coming-in-powershell-7-1-cloudsavvy-it\/#Updated_Core_Modules_and_Loading_Improvements\" >Updated Core Modules and Loading Improvements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-coming-in-powershell-7-1-cloudsavvy-it\/#New_Engine_Features\" >New Engine Features<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-coming-in-powershell-7-1-cloudsavvy-it\/#Additional_Improvements\" >Additional Improvements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-coming-in-powershell-7-1-cloudsavvy-it\/#Breaking_Changes\" >Breaking Changes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-coming-in-powershell-7-1-cloudsavvy-it\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#What\u2019s Coming in PowerShell 7.1 \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4374\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/8fec593cd19e3b20a0773cafaaaaf848\/p\/uploads\/2020\/03\/23e4a5a4.png\" alt=\"Powershell logo\" width=\"1400\" height=\"578\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>PowerShell 7.1 may not look like it has huge changes at first glance, but there is a lot more going on under the hood than one may expect. There are also a number of very useful features and tools that can enhance your <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">script<\/a>ing and help you develop even better scripts. PowerShell 7.1 was released on 11\/11\/2020 and is quickly becoming adopted by many in the IT community. This article goes into a number of improvements and enhancements but is by no means a comprehensive collection of all the improvements.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Architectural_Changes\"><\/span>Architectural Changes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>By the biggest improvement is that of PowerShell 7.1 being built on the just-released .NET 5. This is a major release that continues the unification journey that .NET has been on with traditional .NET and .NET Core. With .NET 5 the first steps into a unified core are realized. PowerShell 7.1 takes advantage of the many performance improvements and language improvements.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Updated_Core_Modules_and_Loading_Improvements\"><\/span>Updated Core Modules and Loading Improvements<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>PowerShell 7.1 includes several core module updates. Notably, PSReadLine 2.1.0 now includes predictive IntelliSense, which is a fish shell-like syntax prediction engine. Additionally, there have been many fixes to the vi-mode and the added ability to set the <code>MaximumHistoryCount<\/code> from a user profile.<\/p>\n<p>To improve <code>WinCompat<\/code> module loading, PowerShell 7 modules are now treated with a higher priority. This prevents inadvertent overwriting of the core modules when using the <code>WinCompat<\/code> mode to enable non-native PowerShell 7 modules to work within the updated PowerShell version.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"New_Engine_Features\"><\/span>New Engine Features<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are, of course, several new core features that are useful. The main three are:<\/p>\n<ul>\n<li><code>PSNullConditionalOperators<\/code><\/li>\n<li><code>PSUnixStat<\/code><\/li>\n<li>TLS 1.3 support<\/li>\n<\/ul>\n<p>Null conditional operators were actually introduced back in PowerShell 7 but as an experimental feature. This feature has now been made mainstream and included by default in PowerShell 7.1. There are two new operators that are <code>??<\/code> and <code>??=<\/code>.<\/p>\n<pre><code class=\"language-powershell\"># This typically replaces an if null statement and will run the output if the value is null.&#13;\n$Object ?? '$object contains a $null value'&#13;\n&#13;\n# When the value of the conditional is null then, assign that object to the value on the right of the conditional.&#13;\n$Object ??= 'This value is assigned on a $null $object'&#13;\n<\/code><\/pre>\n<p>Next, we have the <code>PSUnixStat<\/code> option, this file states that it is now moved out of experimental but sometimes may still appear as experimental. This feature will only be available on Linux systems. You can find out its status and turn on the feature by doing the following.<\/p>\n<pre><code class=\"language-powershell\"># Make sure this feature is enabled, will need to restart the PowerShell session&#13;\nGet-ExperimentalFeature -Name 'PSUnixFileStat' | Enable-ExperimentalFeature&#13;\n<\/code><\/pre>\n<p>This feature will give you a new <code>UnixMode<\/code> property that displays information from the Unix <code>stat<\/code> command. This is very useful for those used to working with traditional Linux permissions.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8199\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/460d7f42540ddbacba5b424da47d5c4c\/p\/uploads\/2020\/11\/9b1b36b5.png\" alt=\"\" width=\"920\" height=\"168\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Finally, TLS 1.3 support is now included in the various web cmdlets such as <code>Invoke-RestMethod<\/code> and <code>Invoke-WebRequest<\/code>. For those that want to utilize the performance and security enhancements that are included in this new TLS version and can interact with an endpoint capable of that, this will be a very useful addition. If the site supports TLS 1.3, the content will be returned and negotiated by the new protocol version.<\/p>\n<pre><code class=\"language-powershell\">Invoke-RestMethod -Uri '&lt;https:\/\/mysite.com&gt;' -SslProtocol Tls13&#13;\n<\/code><\/pre>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Additional_Improvements\"><\/span>Additional Improvements<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are a handful of additional features and improvements that help to enhance your script abilities and structure.<\/p>\n<ul>\n<li>Within the Windows environment, <code>Start-Process<\/code> will now, by default, include all environment variables from the current session. Only when using the <code>UseNewEnvironment<\/code> parameter will an environment be created with new process variables.<\/li>\n<li>The <code>ForEach-Object -Parallel<\/code> command will now reuse runspaces. This will improve memory and performance usage. For those concerned that maximum runspace isolation is not being achieved, the parameter <code>UseNewRunspace<\/code> is now included to create a brand new runspace for each pipeline iteration.<\/li>\n<li>The <code>Get-Random<\/code> command now includes the <code>Shuffle<\/code> parameter. This will take a collection piped into <code>Get-Random<\/code> or via <code>InputObject<\/code> and return the same collection but shuffled in order.<\/li>\n<li>Add the parameter <code>AsUTC<\/code> to the <code>Get-Date<\/code> command. This simplifies the traditional conversion utilities needed, such as with the <code>[DateTime]<\/code> object.<\/li>\n<li>Implement the <code>Stop-Computer<\/code> cmdlet for Linux and macOS systems. This relies on the binary <code>\/sbin\/shutdown<\/code> being available. If the OS is Linux, the argument passed is <code>now<\/code> and if the OS is macOS then the argument passed is <code>-P now<\/code>.<\/li>\n<li>Similar to <code>Stop-Computer<\/code>, <code>Restart-Computer<\/code> is now implemented for Linux and macOS systems. This uses the binary <code>\/sbin\/shutdown<\/code> and passes the argument of <code>-r now<\/code>.<\/li>\n<\/ul>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Breaking_Changes\"><\/span>Breaking Changes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Finally, there is a handful of breaking changes. There are more listed, but these two may affect scripts more than others.<\/p>\n<ul>\n<li>The rename of\u00a0<code>FromUnixTime<\/code>\u00a0to\u00a0<code>UnixTimeSeconds<\/code>\u00a0on the\u00a0<code>Get-Date<\/code>\u00a0cmdlet to allow Unix time input may impact scripts that use this feature and will need to be updated.<\/li>\n<li>Do not wrap return result to\u00a0<code>PSObject<\/code>\u00a0when converting ScriptBlock to delegate types. This is a edge case situation when casting a scriptblock and you want the return type to be the original object and not cast to a PSObject.<\/li>\n<\/ul>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>PowerShell 7.1 may not seem like it has introduced huge new features, but there are many incremental improvements and major backend engine enhancements. The PowerShell ecosystem and language continues to improve with every iteration and is quickly becoming a popular and staple language for system administrators everywhere.\n<\/p><\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener noreferrer\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/8198\/whats-coming-in-powershell-7-1\/\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#What\u2019s Coming in PowerShell 7.1 \u2013 CloudSavvy IT&#8221; PowerShell 7.1 may not look like it has huge changes at first glance, but there is a lot more going on under the hood than one may expect. There are also a number of very useful features and tools that can enhance your scripting and help you&#8230;<\/p>\n","protected":false},"author":1,"featured_media":120996,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/03\/23e4a5a4.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-120995","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/120995","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=120995"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/120995\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/120996"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=120995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=120995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=120995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}