Chapter 21: Scripting and Remote Access
To write a PowerShell script to find other scripts in a user profile directory and all its subdirectories, you need the $home environment variable. There are a number of ways of writing this script to achieve the solution. The following is just one of the possibilities, using the parameters found on the Microsoft website:
Get-ChildItem -Path $home\* -Include *.ps1 -Recurse