powershell find location of commandlet

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?
jackjohnson44Asked:
Who is Participating?
 
Brent ChallisConnect With a Mentor Principal: ITCommented:
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

0
 
LindySCommented:
There are no commands in powershell or the Quest snapin that match that.
Could it be a function added to your profile?
0
 
Dale HarrisProfessional Services EngineerCommented:
Type into your Powershell console the following:

Notepad $profile

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

DH
0
 
Brent ChallisPrincipal: ITCommented:
If you run the following code you will get a list of all the profiles that are currently active as there are 4 possibilities.
$PROFILE.CurrentUserAllHosts
$PROFILE.CurrentUserCurrentHost
$PROFILE.AllUsersAllHosts
$PROFILE.AllUsersCurrentHost

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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.