# What's in my PowerShell profile again?

I know I'm not the only one who encountered this issue before: You write some helper functions in your PowerShell profile, but can't remember what there are. So you have to go back in your profile to see what's in there.

I've been trying to find a solution to this problem for quite a while. My first thought was to use `Get-Command`, but that does not give you whether or not a command comes from the profile.

My second try was to add a tag in the function definition, use `Get-Command` to parse the function definitions for that tag.

Bu then, I had an epiphany, and wrote this little piece of code:

``` PowerShell
Write-Host "Available Profile Functions:" -ForegroundColor Green
$profileData = Get-Content $profile
$profileData += Get-Content $profile.AllUsersAllHosts -ErrorAction SilentlyContinue
$profileData += Get-Content $profile.AllUsersCurrentHost -ErrorAction SilentlyContinue
$profileData -match "^function" `
| ForEach-Object { $_.split(" ")[1] } `
| Sort-Object -Unique `
| ForEach-Object { Write-Host "`t$_" -ForegroundColor Green }
``` 

So what does this do?

The basic idea is as follows:

1. Get the contents of the $profile files that could be loaded in the current host.
2. Get all the lines that start with the keyword `function`
3. Split the line and only keep the function name
4. Keep only the unique names
5. Print the functions at the start of the console session

I hope this will help you use your PowerShell profile more efficiently.

