O'Reilly logo

Instant Windows PowerShell Guide by Harshul Patel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Script it (Advanced)

This recipe elaborates CMDLETs and the parameters that are introduced in Version 3 and can be useful to write efficient scripts with optimized efforts.

Getting ready

We have the default ISE module introduced in PowerShell Version 3.0.

How to do it...

  1. The following command statements create an ISE snippet that is reusable in any script. The Text parameter carries the actual string that is supplied as the snippet. We can also specify the Description, Title, and Author parameters if required.
    PS C:\ > $Script = @' 
    Hello Everyone
    Snippet is awesome 
    '@
    PS C:\ > New-IseSnippet -Description TestSnippet -Text $Script -Title TestSnippet –Author "Harshul"
    

    Note

    You should supply relevant information as text. I, for example, have used random ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required