How to find module that contains function?

Welcome Forums General PowerShell Q&A How to find module that contains function?

This topic contains 1 reply, has 2 voices, and was last updated by

5 years, 3 months ago.

  • Author
  • #15063

    Topics: 1
    Replies: 1
    Points: 0
    Rank: Member

    This doesn't do what I expect:
    > get-command | where { $_.Name -Like "dh" }

    CommandType Name ModuleName
    ———– —- ———-
    Function dh

    Why is "ModuleName" blank? How can I work around this?
    Thanks —

  • #15064

    Topics: 9
    Replies: 2322
    Points: 0
    Rank: Member

    Not all functions are imported from modules. If they're part of a dot-sourced ps1 script (such as your profile), ModuleName will be blank. There are also a number of built-in functions which don't have a module name either ("C:", "cd..", etc.) I assume that those come from the Microsoft.PowerShell.Core PSSnapin, rather than from a module.

The topic ‘How to find module that contains function?’ is closed to new replies.