Share via


#StupidProfileTrick - FunctionList

As I previously posted, my $Profile is stupidly complicated, and it adds a ton of functions.  Which ones did I add?

(Reason this is of interest to me is because I mistakenly named a function with the same name as a cmdlet.  Yeah, totally stupid move on my part.  More on that later.)

 
#region start of $profile

if (!$host.FunctionListPreProfile)
{
    Add-Member -Name FunctionListPreProfile -InputObject $Host -Value (
        Get-ChildItem -Path Function:\
    ) -MemberType NoteProperty -Force;
}

#endregion
#region rest of $profile

Do-Stuff

#endregion
#region end of $profile

Add-Member -Name FunctionListAddedByProfile -InputObject $host -Value (
    Compare-Object -ReferenceObject $host.FunctionListPreProfile -DifferenceObject (
        Get-ChildItem -Path Function:\
    ) | 
    % { 
        $_.InputObject 
    }
) -MemberType NoteProperty -Force;

#endregion