Snippets/Error Handling/try-finally.snippets.ps1xml

<?xml version='1.0' encoding='utf-8' ?>
    <Snippets xmlns='http://schemas.microsoft.com/PowerShell/Snippets'>
        <Snippet Version='1.0.0'>
            <Header>
                <Title>try...finally</Title>
                <Description></Description>
                <Shortcut>fin</Shortcut>
                <Keywords>scriptblock</Keywords>
                <Author>ISESteroids</Author>
                <DifficultyLevel>1</DifficultyLevel>
                <Example>False</Example>
                <SnippetTypes>
                    <SnippetType>Expansion</SnippetType>
                    <SnippetType>SurroundsWith</SnippetType>
                    <SnippetType>Refactor</SnippetType>
                </SnippetTypes>
                <Requirements>
                    <MinimumPowerShellVersion>1</MinimumPowerShellVersion>
                    <RequiredModules></RequiredModules>
                    <AdminPrivileges>False</AdminPrivileges>
                    <ProcessorArchitecture>x86,x64</ProcessorArchitecture>
                </Requirements>
            </Header>
            <Declarations>
                <Literal>
                   <ID><![CDATA[10;9;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[Code to monitor]]></ToolTipStatusbar>
                   <EncloseSelection>true</EncloseSelection>
                   <SupportsSurroundsWith>true</SupportsSurroundsWith>
                </Literal>
                <Literal>
                   <ID><![CDATA[38;81;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[Code to execute when monitored code has finished]]></ToolTipStatusbar>
                </Literal>
            </Declarations>
 
 
            <Code>
                <Script Language='PowerShell' CaretOffset='122'>
                    <![CDATA[try
{
  # Content
}
finally
{
  # This will execute after code in
  # try block has finished or was interrupted
}]]>
                </Script>
            </Code>
 
    </Snippet>
</Snippets>