GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Windows/SysWOW64/WindowsPowerShell/v1.0/Modules/ISE/en-US/ |
Upload File : |
<?xml version="1.0" encoding="utf-8"?> <helpItems schema="maml" xmlns="http://msh"> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-IseSnippet</command:name> <command:verb>Get</command:verb> <command:noun>IseSnippet</command:noun> <maml:description> <maml:para>Gets snippets that the user created.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `Get-IseSnippet` cmdlet gets the PS1XML files that contain reusable text snippets that the user created. It works only in Windows PowerShell Integrated Scripting Environment (ISE).</maml:para> <maml:para>When you use the `New-IseSnippet` cmdlet to create a snippet, `New-IseSnippet` creates a `<SnippetTitle>.Snippets.ps1xml` file in the `$home\Documents\WindowsPowerShell\Snippets` directory. `Get-IseSnippet` gets the snippet files in the Snippets directory.</maml:para> <maml:para>This cmdlet does not get built-in snippets or snippets that are imported from modules through the `Import-IseSnippet` cmdlet.</maml:para> <maml:para>This cmdlet was introduced in Windows PowerShell 3.0.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-IseSnippet</maml:name> </command:syntaxItem> </command:syntax> <command:parameters /> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.IO.FileInfo</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet returns a file object that represents the snippet file.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>* The `New-IseSnippet` cmdlet stores new user-created snippets in unsigned .ps1xml files. As such, Windows PowerShell cannot add them to a session in which the execution policy is AllSigned or Restricted . In a Restricted or AllSigned session, you can create, get, and import unsigned user-created snippets, but you cannot use them in the session.</maml:para> <maml:para> To use unsigned user-created snippets that the `Get-IseSnippet` cmdlet returns, change the execution policy, and then restart Windows PowerShell ISE.</maml:para> <maml:para> For more information about Windows PowerShell execution policies, see about_Execution_Policies (../Microsoft.PowerShell.Core/About/about_Execution_Policies.md).</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>----------- Example 1: Get all user-defined snippets -----------</maml:title> <dev:code>Get-IseSnippet</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Copy all user-defined snippets from remote computers to a shared directory</maml:title> <dev:code>Invoke-Command -Computer (Get-Content Servers.txt) {Get-IseSnippet | Copy-Item -Destination \\Server01\Share01\Snippets}</dev:code> <dev:remarks> <maml:para>`Invoke-Command` runs `Get-IseSnippet` on the computers in the `Servers.txt` file. A pipeline operator (`|`) sends the snippet files to the `Copy-Item` cmdlet, which copies them to the directory that is specified by the Destination parameter.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Display the title and text of each snippet on a local computer</maml:title> <dev:code>#Parse-Snippet Function function Parse-Snippet { $SnippetFiles = Get-IseSnippet $SnippetNamespace = @{x="http://schemas.microsoft.com/PowerShell/Snippets"} foreach ($SnippetFile in $SnippetFiles) { Write-Host "" $Title = Select-Xml -Path $SnippetFile.FullName -Namespace $SnippetNamespace -XPath "//x:Title" | ForEach-Object {$_.Node.InnerXML} $Text = Select-Xml -Path $SnippetFile.FullName -Namespace $SnippetNamespace -XPath "//x:Script" | ForEach-Object {$_.Node.InnerText} Write-Host "Title: $Title" Write-Host "Text: $Text" } } Title: Mandatory Text: Param ( [parameter(Mandatory=True)] [String[]] $<ParameterName> ) Title: Copyright Text: (c) Fabrikam, Inc. 2012</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Display the title and description of all snippets in the session</maml:title> <dev:code>$PSISE.CurrentPowerShellTab.Snippets | Format-Table DisplayTitle, Description</dev:code> <dev:remarks> <maml:para>The `$PSISE` variable represents the Windows PowerShell ISE host program. The CurrentPowerShellTab property of the `$PSISE` variable represent the current session. The Snippets property represents snippets in the current session.</maml:para> <maml:para>The `$PSISE.CurrentPowerShellTab.Snippets` command returns a Microsoft.PowerShell.Host.ISE.ISESnippet object that represents a snippet, unlike the `Get-IseSnippet` cmdlet. `Get-IseSnippet` returns a file object (System.Io.FileInfo) that represents a snippet file.</maml:para> <maml:para>The `Format-Table` cmdlet displays the DisplayTitle and Description properties of the snippets in a table.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://docs.microsoft.com/powershell/module/ise/get-isesnippet?view=powershell-5.1&WT.mc_id=ps-gethelp</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-IseSnippet</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-IseSnippet</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Import-IseSnippet</command:name> <command:verb>Import</command:verb> <command:noun>IseSnippet</command:noun> <maml:description> <maml:para>Imports ISE snippets into the current session</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `Import-IseSnippet` cmdlet imports reusable text "snippets" from a module or a directory into the current session. The snippets are immediately available for use in Windows PowerShell ISE. This cmdlet works only in Windows PowerShell Integrated Scripting Environment (ISE).</maml:para> <maml:para>To view and use the imported snippets, from the Windows PowerShell ISE Edit menu, click **Start Snippets** or press <kbd>Ctrl</kbd>+<kbd>J</kbd>.</maml:para> <maml:para>Imported snippets are available only in the current session. To import the snippets into all Windows PowerShell ISE sessions, add an `Import-IseSnippet` command to your Windows PowerShell profile or copy the snippet files to your local snippets directory `$home\Documents\WindowsPowershell\Snippets`.</maml:para> <maml:para>To import snippets, they must be properly formatted in the snippet XML for Windows PowerShell ISE snippets and saved in Snippet.ps1xml files. To create eligible snippets, use the `New-IseSnippet` cmdlet. `New-IseSnippet` creates a `<SnippetTitle>.Snippets.ps1xml` file in the `$home\Documents\WindowsPowerShell\Snippets` directory. You can move or copy the snippets to the Snippets directory of a Windows PowerShell module, or to any other directory.</maml:para> <maml:para>The `Get-IseSnippet` cmdlet, which gets user-created snippets in the local snippets directory, does not get imported snippets.</maml:para> <maml:para>This cmdlet was introduced in Windows PowerShell 3.0.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Import-IseSnippet</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ListAvailable</maml:name> <maml:Description> <maml:para>Indicates that this cmdlet gets snippets from modules that are installed on the computer, even if the modules are not imported into the current session. If this parameter is omitted, and the module that is specified by the Module parameter is not imported into the current session, the attempt to get the snippets from the module fails.</maml:para> <maml:para>This parameter is valid only when the Module parameter is used in the command.</maml:para> </maml:Description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Module</maml:name> <maml:Description> <maml:para>Imports snippets from the specified module into the current session. Wildcard characters are not supported.</maml:para> <maml:para>This parameter imports snippets from Snippet.ps1xml files in the Snippets subdirectory in the module path, such as `$home\Documents\WindowsPowerShell\Modules<ModuleName>\Snippets`.</maml:para> <maml:para>This parameter is designed to be used by module authors in a startup script, such as a script specified in the ScriptsToProcess key of a module manifest. Snippets in a module are not automatically imported with the module, but you can use an `Import-IseSnippet` command to import them.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Recurse</maml:name> <maml:Description> <maml:para>Indicates that this cmdlet imports snippets from all subdirectories of the value of the Path parameter.</maml:para> </maml:Description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Import-IseSnippet</maml:name> <command:parameter required="true" variableLength="true" globbing="true" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:Description> <maml:para>Specifies the path to the snippets directory in which this cmdlet imports snippets.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Recurse</maml:name> <maml:Description> <maml:para>Indicates that this cmdlet imports snippets from all subdirectories of the value of the Path parameter.</maml:para> </maml:Description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ListAvailable</maml:name> <maml:Description> <maml:para>Indicates that this cmdlet gets snippets from modules that are installed on the computer, even if the modules are not imported into the current session. If this parameter is omitted, and the module that is specified by the Module parameter is not imported into the current session, the attempt to get the snippets from the module fails.</maml:para> <maml:para>This parameter is valid only when the Module parameter is used in the command.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.Management.Automation.SwitchParameter</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Module</maml:name> <maml:Description> <maml:para>Imports snippets from the specified module into the current session. Wildcard characters are not supported.</maml:para> <maml:para>This parameter imports snippets from Snippet.ps1xml files in the Snippets subdirectory in the module path, such as `$home\Documents\WindowsPowerShell\Modules<ModuleName>\Snippets`.</maml:para> <maml:para>This parameter is designed to be used by module authors in a startup script, such as a script specified in the ScriptsToProcess key of a module manifest. Snippets in a module are not automatically imported with the module, but you can use an `Import-IseSnippet` command to import them.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="true" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:Description> <maml:para>Specifies the path to the snippets directory in which this cmdlet imports snippets.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Recurse</maml:name> <maml:Description> <maml:para>Indicates that this cmdlet imports snippets from all subdirectories of the value of the Path parameter.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.Management.Automation.SwitchParameter</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet does not take input from the pipeline.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet does not generate output.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>- You cannot use the `Get-IseSnippet` cmdlet to get imported snippets. `Get-IseSnippet` gets only snippets in the `$home\Documents\WindowsPowerShell\Snippets` directory. - `Import-IseSnippet` uses the Load static method of Microsoft.PowerShell.Host.ISE.ISESnippetCollection objects. You can also use the Load method of snippets in the Windows PowerShell ISE object model: `$psISE.CurrentPowerShellTab.Snippets.Load()` - The `New-IseSnippet` cmdlet stores new user-created snippets in unsigned .ps1xml files. As such, Windows PowerShell cannot load them into a session in which the execution policy is AllSigned or Restricted . In a Restricted or AllSigned session, you can create, get, and import unsigned user-created snippets, but you cannot use them in the session.</maml:para> <maml:para> To use unsigned user-created snippets that the `Import-IseSnippet` cmdlet returns, change the execution policy, and then restart Windows PowerShell ISE.</maml:para> <maml:para> For more information about Windows PowerShell execution policies, see about_Execution_Policies (../Microsoft.PowerShell.Core/About/about_Execution_Policies.md).</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--------- Example 1: Import snippets from a directory ---------</maml:title> <dev:code>Import-IseSnippet -Path \\Server01\Public\Snippets -Recurse</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----------- Example 2: Import snippets from a module -----------</maml:title> <dev:code>Import-IseSnippet -Module SnippetModule -ListAvailable</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------------- Example 3: Find snippets in modules -------------</maml:title> <dev:code>($env:PSModulePath).split(";") | ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | ForEach-Object {$_.fullname}</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------------ Example 4: Import all module snippets ------------</maml:title> <dev:code>($env:PSModulePath).split(";") | ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | ForEach-Object {$psise.CurrentPowerShellTab.Snippets.Load($_)}</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------------- Example 5: Copy all module snippets -------------</maml:title> <dev:code>($env:PSModulePath).split(";") | ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | Copy-Item -Destination $home\Documents\WindowsPowerShell\Snippets</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://docs.microsoft.com/powershell/module/ise/import-isesnippet?view=powershell-5.1&WT.mc_id=ps-gethelp</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-IseSnippet</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-IseSnippet</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-IseSnippet</command:name> <command:verb>New</command:verb> <command:noun>IseSnippet</command:noun> <maml:description> <maml:para>Creates a Windows PowerShell ISE code snippet.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `New-ISESnippet` cmdlet creates a reusable text "snippet" for Windows PowerShell ISE. You can use snippets to add text to the Script pane or Command pane in Windows PowerShell ISE. This cmdlet is available only in Windows PowerShell ISE.</maml:para> <maml:para>Beginning in Windows PowerShell 3.0, Windows PowerShell ISE includes a collection of built-in snippets. The `New-ISESnippet` cmdlet lets you create your own snippets to add to the built-in collection. You can view, change, add, delete, and share snippet files and include them in Windows PowerShell modules. To see snippets in Windows PowerShell ISE, from the Edit menu, select Start Snippets or press <kbd>CTRL</kbd>+<kbd>J</kbd>.</maml:para> <maml:para>The `New-ISESnippet` cmdlet creates a `<Title>.Snippets.ps1xml` file in the `$home\Documents\WindowsPowerShell\Snippets` directory with the title that you specify. To include a snippet file in a module that you are authoring, add the snippet file to a Snippets subdirectory of your module directory.</maml:para> <maml:para>You cannot use user-created snippets in a session in which the execution policy is Restricted or AllSigned .</maml:para> <maml:para>This cmdlet was introduced in Windows PowerShell 3.0.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-IseSnippet</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Title</maml:name> <maml:Description> <maml:para>Specifies a title or name for the snippet. The title also names the snippet file. This parameter is required.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Description</maml:name> <maml:Description> <maml:para>Specifies a description of the snippet. The description value appears when you click the snippet name in Windows PowerShell ISE. This parameter is required.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none"> <maml:name>Text</maml:name> <maml:Description> <maml:para>Specifies the text value that is added when you select the snippet. The snippet text appears when you click the snippet name in Windows PowerShell ISE. This parameter is required.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Author</maml:name> <maml:Description> <maml:para>Specifies the author of the snippet. The author field appears in the snippet file, but it does not appear when you click the snippet name in Windows PowerShell ISE.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CaretOffset</maml:name> <maml:Description> <maml:para>Specifies the character of the snippet text that this cmdlet places the cursor on. Enter an integer that represents the cursor position, with "1" representing the first character of text. The default value, 0 (zero), places the cursor immediately before the first character of text. This parameter does not indent the snippet text.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.Int32</command:parameterValue> <dev:type> <maml:name>System.Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:Description> <maml:para>Indicates that this cmdlet overwrites snippet files with the same name in the same location. By default, `New-ISESnippet` does not overwrite files.</maml:para> </maml:Description> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Author</maml:name> <maml:Description> <maml:para>Specifies the author of the snippet. The author field appears in the snippet file, but it does not appear when you click the snippet name in Windows PowerShell ISE.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CaretOffset</maml:name> <maml:Description> <maml:para>Specifies the character of the snippet text that this cmdlet places the cursor on. Enter an integer that represents the cursor position, with "1" representing the first character of text. The default value, 0 (zero), places the cursor immediately before the first character of text. This parameter does not indent the snippet text.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.Int32</command:parameterValue> <dev:type> <maml:name>System.Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Description</maml:name> <maml:Description> <maml:para>Specifies a description of the snippet. The description value appears when you click the snippet name in Windows PowerShell ISE. This parameter is required.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:Description> <maml:para>Indicates that this cmdlet overwrites snippet files with the same name in the same location. By default, `New-ISESnippet` does not overwrite files.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.Management.Automation.SwitchParameter</command:parameterValue> <dev:type> <maml:name>System.Management.Automation.SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none"> <maml:name>Text</maml:name> <maml:Description> <maml:para>Specifies the text value that is added when you select the snippet. The snippet text appears when you click the snippet name in Windows PowerShell ISE. This parameter is required.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Title</maml:name> <maml:Description> <maml:para>Specifies a title or name for the snippet. The title also names the snippet file. This parameter is required.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">System.String</command:parameterValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet does not take input from the pipeline.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet does not generate any output.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>`New-IseSnippet` stores new user-created snippets in unsigned .ps1xml files. As such, Windows PowerShell cannot add them to a session in which the execution policy is AllSigned or Restricted . In a Restricted or AllSigned session, you can create, get, and import unsigned user-created snippets, but you cannot use them in the session.</maml:para> <maml:para>If you use the `New-IseSnippet` cmdlet in a Restricted or AllSigned session, the snippet is created, but an error message appears when Windows PowerShell tries to add the newly created snippet to the session. To use the new snippet (and other unsigned user-created snippets), change the execution policy, and then restart Windows PowerShell ISE.</maml:para> <maml:para>For more information about Windows PowerShell execution policies, see about_Execution_Policies.</maml:para> <maml:para>- To change a snippet, edit the snippet file. You can edit snippet files in the Script pane of Windows PowerShell ISE. - To delete a snippet that you added, delete the snippet file.</maml:para> <maml:para>- You cannot delete a built-in snippet, but you can hide all built-in snippets by using the</maml:para> <maml:para> "$psise.Options.ShowDefaultSnippets=$false" command. - You can create a snippet that has the same name as a built-in snippet. Both snippets appear in the snippet menu in Windows PowerShell ISE.</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------- Example 1: Create a Comment-Based help snippet --------</maml:title> <dev:code>New-IseSnippet -Title Comment-BasedHelp -Description "A template for comment-based help." -Text "<# .SYNOPSIS .DESCRIPTION .PARAMETER <Parameter-Name> .INPUTS .OUTPUTS .EXAMPLE .LINK #>"</dev:code> <dev:remarks> <maml:para>This command creates a Comment-BasedHelp snippet for Windows PowerShell ISE. It creates a file named `Comment-BasedHelp.snippets.ps1xml` in the user's Snippets directory `$home\Documents\WindowsPowerShell\Snippets`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------------ Example 2: Create a mandatory snippet ------------</maml:title> <dev:code>$M = @' Param ( [parameter(Mandatory=$true)] [String[]] $<ParameterName> ) '@ New-ISESnippet -Text $M -Title Mandatory -Description "Adds a mandatory function parameter." -Author "Patti Fuller, Fabrikam Corp." -Force</dev:code> <dev:remarks> <maml:para>This example creates a snippet named Mandatory for Windows PowerShell ISE. The first command saves the snippet text in the `$M` variable. The second command uses the `New-ISESnippet` cmdlet to create the snippet. The command uses the Force parameter to overwrite a previous snippet with the same name.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Copy a mandatory snippet from a folder to a destination folder</maml:title> <dev:code>Copy-Item "$Home\Documents\WindowsPowerShell\Snippets\Mandatory.Snippets.ps1xml" -Destination "\\Server\Share"</dev:code> <dev:remarks> <maml:para>This command uses the `Copy-Item` cmdlet to copy the Mandatory snippet from the folder where `New-ISESnippet` places it to the Server\Share file share.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://docs.microsoft.com/powershell/module/ise/new-isesnippet?view=powershell-5.1&WT.mc_id=ps-gethelp</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-IseSnippet</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-IseSnippet</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> </helpItems>