User-Defined Aliases using PowerShell Profiles
A Profile is script that runs at startup of the session. The location of the Profile is stored in the $Profile variable, which by default is “My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1″
The Windows PowerShell profile is simply a script file that runs when Windows PowerShell starts up. You can put cmdlets, scripts, functions – any valid Windows PowerShell commands – into this script file. Each time you start Windows PowerShell, this script file will run. That means you can use the profile to set up your Windows PowerShell environment. Typically that would be custom console settings and aliases, but use your imagination and you can come up with other things you’d like to customize in PowerShell before you start working with it.
There is no specific cmdlet set aside for removing a user defined powershell alias, but you can achieve the task by Remove-item.
To remove an alias named “gs”
User-Defined PowerShell Aliases
Syntax to create User-defined alias:
Set-Alias alias command
example:[code] Set-Alias gs Get-Service [/code]
In PowerShell, an alias is another name assigned to a cmdlet, function, script, executable file, and so on. Just about anything you can run from the PowerShell command prompt can have an alias assigned to it.Windows users can utilize commands like dir, move, type, cls, etc… PowerShell also provides a set of aliases for Linux; ls, pwd, mv, man, cat, etc… PowerShell Aliases are provided for the purpose of allowing new users the ability to quickly interact with the shell. An alias is an alternative name assigned to a cmdlet. For example, “dir” is an alias for “Get-ChildItem.” This tutorial presents two types of aliases:
Built-in Aliases – Predefined alternative names for Windows, Unix, and PowerShell cmdlets.
User-defined Aliases – Custom alternative names created by the user.
Command to know the version of Powershell Type In the below example you will notice that the powershell version 3.0 is being displayed. There are four categories of PowerShell commands: Cmdlet (Command-Let) PowerShell Functions PowerShell Scripts Native Windows commands. PowerShell commands have been standardized using a “verb-noun” naming convention know as a cmdlet. This standard […]
What is Powershell? PowerShell is a new command shell from Microsoft and yes it is a command prompt and scripting environment, it can even be both at the same time. Windows PowerShell is an extendable command shell and scripting language which can be used to manage/administer server environments like Windows Server, Exchange and also SharePoint […]