Snippets/Error Handling/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>finally</Title>
                <Description>appends &quot;finally&quot; block to an existing TRY block.
This code will be executed even if the user stops the script while it is executing code in a try block.</Description>
                <Shortcut>fin</Shortcut>
                <Keywords>ScriptBlock</Keywords>
                <Author>Tobias</Author>
                <DifficultyLevel>4</DifficultyLevel>
                <Example>False</Example>
                <SnippetTypes>
                    <SnippetType>Expansion</SnippetType>
                    <SnippetType>SurroundsWith</SnippetType>
                </SnippetTypes>
                <Requirements>
                    <MinimumPowerShellVersion>1</MinimumPowerShellVersion>
                    <RequiredModules></RequiredModules>
                    <AdminPrivileges>False</AdminPrivileges>
                    <ProcessorArchitecture>x86,x64</ProcessorArchitecture>
                </Requirements>
            </Header>
            <Declarations>
                <Literal>
                   <ID><![CDATA[14;30;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[code to execute regardless of errors]]></ToolTipStatusbar>
                   <EncloseSelection>true</EncloseSelection>
                </Literal>
            </Declarations>
 
 
            <Code>
                <Script Language='PowerShell' CaretOffset='0'>
                    <![CDATA[finally
{
  'I can do cleanup things here'
 
}
]]>
                </Script>
            </Code>
 
    </Snippet>
</Snippets>