powershell find location of commandlet

Posted on 2011-10-14
Last Modified: 2012-05-12
I have a commandlet called Log-Registrar and I am not sure where this is located on the server machine I am using.  If I type log-r then press tab it will auto complete.  How can I find the file that contains this command?
Question by:jackjohnson44
    LVL 3

    Expert Comment

    There are no commands in powershell or the Quest snapin that match that.
    Could it be a function added to your profile?
    LVL 16

    Expert Comment

    by:Dale Harris
    Type into your Powershell console the following:

    Notepad $profile

    and see if it's built in like LindyS is saying.

    LVL 8

    Expert Comment

    If you run the following code you will get a list of all the profiles that are currently active as there are 4 possibilities.

    The cmdlet you are looking for should be in one of the files listed.

    Bear in mind, though, if there is an Import-Module cmdlet in any profile file, the cmdlet could be in the files in the module.
    LVL 8

    Accepted Solution

    As an enhancement of my previous comment:

    If you run the attached code in the PowerShell_ISE editor it will load all the currently active profiles.  You can then search the files for the declaration of the cmdlet.  If looking for 'Log-Registrar', or better 'function Log-Registrar' doesn't find anything you will need to look for Import-Module statements and perhaps Add-PSSnapin as these comdlets are other ways of adding functionality.

    if (Test-Path $PROFILE.CurrentUserAllHosts)
        $psise.CurrentPowerShellTab.Files.Add($PROFILE.CurrentUserAllHosts) | Out-Null
    if (Test-Path $PROFILE.CurrentUserCurrentHost)
        $psise.CurrentPowerShellTab.Files.Add($PROFILE.CurrentUserCurrentHost) | Out-Null
    if (Test-Path $PROFILE.AllUsersAllHosts)
        $psise.CurrentPowerShellTab.Files.Add($PROFILE.AllUsersAllHosts) | Out-Null
    if (Test-Path $PROFILE.AllUsersCurrentHost)
        $psise.CurrentPowerShellTab.Files.Add($PROFILE.AllUsersCurrentHost) | Out-Null

    Open in new window


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
    The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now