Many of you who have taken my PowerShell class may remember that I strongly advocate to not use person aliases in your scripts. They are fine for shell use, but not in scripts. This is for two reasons. The first reason is that they make your scripts less readable to others. These are your personal aliases that no help file exists for. The second, and most important, is that your scripts are not portable. For someone else to use a script with your custom alias in it, they would have to add to their profile the code to create your alias. If you do utilize aliases, you will want to load a PowerShell session that does not load your profile to test your script prior to delivery. This way you will know for sure if your script is portable or not with regards to aliases. To add code to make sure the other client as the modules that you need, check out my code for Confirm-Module.
To open a PowerShell session without your profile:
PowerShell.exe –NoProfile
Comments