How to import a new powershell cmdlet?


I have just downloaded the Register-TemporaryEvent cmdlet from and placed it in my powershell profile directory near the $profile script.

How do I create a new command Register-TemporaryEvent which would be bound to this script?



With PowerShell, you can execute scripts as commands if they are placed in directories contained in the ‘PATH’ environment variable. To see what directories are in the Path, you can use:

You could modify the path permanently from Windows’ System Properties to include the location of your scripts, or you could temporarily modify the path from within your profile or script. In your particular case, you could add the following to your profile to add the profile directory to the path:

You can then run the command as:

Note: When tab completing, it will complete as Register-TemporaryEvent.ps1, but you can remove the ‘.ps1’ and it will still work.


How to import a new powershell cmdlet? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply