{"id":19226,"date":"2021-10-25T11:27:56","date_gmt":"2021-10-25T19:27:56","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powershell\/?p=19226"},"modified":"2022-02-14T11:07:19","modified_gmt":"2022-02-14T19:07:19","slug":"announcing-powershell-crescendo-preview-4","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/announcing-powershell-crescendo-preview-4\/","title":{"rendered":"Announcing PowerShell Crescendo Preview.4"},"content":{"rendered":"<h2>Announcing Crescendo 0.7.0-Preview.4<\/h2>\n<p>We are pleased to announce the fourth preview of <strong>PowerShell Crescendo<\/strong>, a framework to rapidly\ndevelop PowerShell cmdlets for native commands, regardless of platform.<\/p>\n<p>The updated preview release is now available for download on the PowerShell Gallery:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.powershellgallery.com\/packages\/Microsoft.PowerShell.Crescendo\/0.7.0\">Microsoft.PowerShell.Crescendo Preview 4<\/a><\/li>\n<\/ul>\n<p>To install <strong>Microsoft.PowerShell.Crescendo<\/strong>:<\/p>\n<pre><code class=\"language-powershell\">Install-Module Microsoft.PowerShell.Crescendo -AllowPrerelease<\/code><\/pre>\n<h2>Crescendo Preview 4 Updates<\/h2>\n<p><strong>Crescendo 0.7.0-Preview.4<\/strong> adds global schema support and experimental help parsing for modern\nnative commands. Read the full list of changes below:<\/p>\n<ul>\n<li>Added global schema support<\/li>\n<li>Added experimental native command help parser. <a href=\"https:\/\/github.com\/PowerShell\/Crescendo\/issues\/99\">Issue #99<\/a><\/li>\n<li>New-CrescendoCommand should include an OriginalName parameter.\n<a href=\"https:\/\/github.com\/PowerShell\/Crescendo\/issues\/82\">Issue #82<\/a><\/li>\n<li>Added Export-CrescendoCommand to create a configuration file.\n<a href=\"https:\/\/github.com\/PowerShell\/Crescendo\/issues\/80\">Issue #80<\/a><\/li>\n<li>Added support for the <strong>ConfirmImpact<\/strong> <code>CmdletBinding()<\/code> argument.<\/li>\n<li>Default parameter values are not used.\n<a href=\"https:\/\/github.com\/PowerShell\/Crescendo\/issues\/101\">Issue #101<\/a><\/li>\n<\/ul>\n<h3>Global Schema support<\/h3>\n<p>In preview 4, we&#8217;ve published the authoring schema for PowerShell Crescendo at a well-known URL.\nThis URL can be referenced instead of a local file path as in previous preview versions. The schema\nworks with supported tools like <a href=\"https:\/\/code.visualstudio.com\">Visual Studio Code<\/a> to provide\nintellisense and tooltips during the authoring experience.<\/p>\n<p>URL location of the always-available Crescendo schema:<\/p>\n<pre><code class=\"language-json\">{\r\n   \"$schema\": \"https:\/\/aka.ms\/PowerShell\/Crescendo\/Schemas\/2021-11\",\r\n   \"Commands\": []\r\n}<\/code><\/pre>\n<h3>Experimental native command Help parsers<\/h3>\n<p>Modern commands that produce structured help output may be parsed for parameter and argument\ninformation to build a PowerShell Crescendo configuration file. This reduces the time to\ndiscover and handle changes, making maintaining Crescendo modules that contain complex native\ncommands easier to maintain.<\/p>\n<p>The Preview 4 release includes several help parsers for native commands. These parsers are\nexperimental and have limitations. For a full discussion about the design and limitations of help\nparsers as well as how to use them, see the help parser\n<a href=\"https:\/\/github.com\/PowerShell\/Crescendo\/blob\/master\/Microsoft.PowerShell.Crescendo\/src\/experimental\/HelpParsers\/README.md\">README<\/a>\nfile.<\/p>\n<p>The experimental help parsers can be found in the\n<a href=\"https:\/\/github.com\/PowerShell\/Crescendo\/blob\/master\/Microsoft.PowerShell.Crescendo\/src\/experimental\/HelpParsers\/\">HelpParsers<\/a>\nfolder in the GitHub repository.<\/p>\n<p>The experimental help parsers may also be found locally in the module folder <code>&lt;PathToModule&gt;\/Microsoft.PowerShell.Crescendo\/src\/experimental\/HelpParsers\/<\/code>.<\/p>\n<h3><code>New-CrescendoCommand<\/code> now includes the <strong>OriginalName<\/strong> parameter<\/h3>\n<p>The cmdlet <code>New-CrescendoCommand<\/code> includes the <strong>OriginalName<\/strong> parameter that specifies the name\nand location of the native command to be wrapped by Crescendo.<\/p>\n<pre><code class=\"language-powershell\">New-CrescendoCommand -Verb Get -Noun MyFeature -OriginalName \"&lt;Path&gt;&lt;Command&gt;\"<\/code><\/pre>\n<h3>Creating a command configuration with <code>Export-CrescendoCommand<\/code><\/h3>\n<p>PowerShell Crescendo users may choose to start a configuration file with a partially populated\ntemplate. <code>New-CrescendoCommand<\/code> can create the command object that can be converted to JSON using\nthe <code>Export-CrescendoCommand<\/code> cmdlet.<\/p>\n<p>To create a JSON configuration file for a single command:<\/p>\n<pre><code class=\"language-powershell\">New-CrescendoCommand -Verb Get -Noun MyFeature -OriginalName MYCommand.exe |\r\n    Export-CrescendoCommand -TargetDirectory C:MyConfig<\/code><\/pre>\n<p>For this example, <code>Export-CrescendoCommand<\/code> creates the file <code>C:MyConfigGet-MyFeature.config.json<\/code>.<\/p>\n<h3>Support for the <strong>ConfirmImpact<\/strong> argument<\/h3>\n<p>When you define a cmdlet that alters the system state you should include the\n<strong>SupportsShouldProcess<\/strong> argument in the <code>CmdletBinding()<\/code> attribute for the cmdlet. The Crescendo\nJSON schema includes <strong>SupportsShouldProcess<\/strong>. Preview 4 adds the <strong>ConfirmImpact<\/strong> argument.\nSupported values for <strong>ConfirmImpact<\/strong> are: <code>Low<\/code>, <code>Medium<\/code>, or <code>High<\/code>.<\/p>\n<h3>Default parameter values are not used<\/h3>\n<p>In previous previews, specifying the default value of a parameter was not recognized and respected\nin the generated Crescendo module. This resulted in a cmdlet parameter without the expected default\nvalue. Starting in Preview 4, parameters defined with default values will now use those default\nvalues unless overridden by the user.<\/p>\n<pre><code class=\"language-json\">{\r\n  \"ParameterSetName\": [\"Default\"],\r\n  \"Name\":\"ProductName\",\r\n  \"OriginalName\": \"-pn\",\r\n  \"ParameterType\": \"string\",\r\n  \"DefaultValue\": \"WinGet\",\r\n  \"Description\": \"This switch provides product name for display\"\r\n}<\/code><\/pre>\n<p>In the example above, the argument default value &#8220;WinGet&#8221; will be applied to the parameter\n<strong>ProductName<\/strong> when the user executes the cmdlet.<\/p>\n<h2>More information about Microsoft.PowerShell.Crescendo<\/h2>\n<p>For more information about <strong>Microsoft.PowerShell.Crescendo<\/strong>, check out these previous blog posts:<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/announcing-powershell-crescendo-preview-3\/\">Announcing PowerShell Crescendo Preview.3<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/announcing-powershell-crescendo-preview-2\/\">Announcing PowerShell Crescendo Preview.2<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/announcing-powershell-crescendo-preview-1\/\">Announcing PowerShell Crescendo Preview.1<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/native-commands-in-powershell-a-new-approach\/\">Native Commands in PowerShell Part 1<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/native-commands-in-powershell-a-new-approach-part-2\/\">Native Commands in PowerShell Part 2<\/a><\/li>\n<\/ul>\n<p>For more information using <strong>Microsoft.PowerShell.Crescendo<\/strong>, check out this excellent blog series\nby Sean Wheeler posted to the\n<a href=\"https:\/\/devblogs.microsoft.com\/powershell-community\/\">PowerShell Community<\/a>.<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powershell-community\/my-crescendo-journey\/\">My Crescendo journey<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powershell-community\/converting-string-output-to-objects\/\">Converting string output to objects<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powershell-community\/a-closer-look-at-the-parsing-code-of-a-crescendo-output-handler\/\">A closer look at the parsing code of a Crescendo output handler<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powershell-community\/a-closer-look-at-the-crescendo-configuration\/\">A closer look at the Crescendo configuration<\/a><\/li>\n<\/ul>\n<h2>Future plans<\/h2>\n<p>The plans for the general release will be based on community feedback and include improved tooling\nand guidance for Crescendo cmdlets. Our goal is to make it easier to convert your native commands to\nPowerShell cmdlets and receive the benefits that PowerShell provides.<\/p>\n<p>We value your ideas and feedback and hope you will give Crescendo a try. Stop by our\n<a href=\"https:\/\/github.com\/PowerShell\/Crescendo\">GitHub repository<\/a> and let us know of any issues you find\nor features you would like added.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the last planned preview before the release candidate (RC). This preview adds support for a globally available schema, several community suggestions, and an experimental help parsing feature to improve complex native command maintenance.<\/p>\n","protected":false},"author":7527,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3173],"class_list":["post-19226","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-powershell-crescendo"],"acf":[],"blog_post_summary":"<p>This is the last planned preview before the release candidate (RC). This preview adds support for a globally available schema, several community suggestions, and an experimental help parsing feature to improve complex native command maintenance.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/19226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/7527"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=19226"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/19226\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=19226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=19226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=19226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}