February 14th, 2013

PowerTip: Easily Create a Script that Creates PowerShell Aliases

Doctor Scripto
Scripter

Summary: Learn how to run a one-line Windows PowerShell command to create a Windows PowerShell script that automatically recreates all of your aliases.

Hey, Scripting Guy! Question I want to create a script that will create a standardized set of Windows PowerShell aliases for my environment. I need to do this in a single line. How can I easily do this?

Hey, Scripting Guy! Answer Use the Export-Alias cmdlet and specify the –As script parameter. Provide a path to store the script, as shown here.

Export-Alias -As script -Path c:\fso\aliases.ps1

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.