powershell find location of commandlet

Posted on 2011-10-14
Medium Priority
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
  • 2

Expert Comment

ID: 36970287
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
ID: 36970554
Type into your Powershell console the following:

Notepad $profile

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


Expert Comment

by:Brent Challis
ID: 36971575
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.

Accepted Solution

Brent Challis earned 2000 total points
ID: 36976903
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Loops Section Overview
Screencast - Getting to Know the Pipeline

829 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