Showing posts with label References. Show all posts
Showing posts with label References. Show all posts

November 20, 2012

How to create a new Snippet in PowerShell ISE 3

Paste this code in a PowerShell ISE new tab :

[scriptblock]$code = 
{#PutYourCodeHere
}

New-IseSnippet `
    -Text $code.ToString() `
    -CaretOffset $code.ToString().Length `
    -Force `
    -Title ‘SnippetTitle’ `
    -Description ‘SnippetDescription’ 

Replace the #PutYourCodeHere by your Powershell commands, set the snippet Title, description and run it. Why not make a snippet to create snippet.

References :

June 22, 2012

.Net framework formating Type for the format operator (-f)

The powershell format operator (-f) let’s you format string using the .NET string object format method. To use this method you have to use a “FormatString” whith a special syntax.

Ex : "{0:yyMMdd}" -f (Get-Date)

You will find bellow somes references in MSDN to various FormatString you can use in your Formating Types :