O'Reilly logo

Windows PowerShell™ 3.0 Step by Step by Ed Wilson

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

Creating a function: step-by-step exercises

In this exercise, you’ll explore the use of the Get-Verb cmdlet to find permissible Windows PowerShell verbs. You will also use Function keyword and create a function. Once you have created the basic function, you’ll add additional functionality to the function in the next exercise.

Creating a basic function

  1. Start Windows PowerShell ISE.

  2. Use the Get-Verb cmdlet to obtain a listing of approved verbs.

  3. Select a verb that would be appropriate for a function that obtains a listing of files by date last modified. In this case, the appropriate verb is Get.

  4. Create a new function named Get-FilesByDate. The code to do this appears here:

    Function Get-FilesByDate
    {
    
    }
  5. Add four command-line parameters to the function. ...

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