This is a short guide for setting up a powershell profile and some of the things I find useful to set. If you have any other recommendations, tweet me @lloyd_delacroix
To get started, the first step of course is to create a powershell profile. Create a new folder your Documents folder called âWindowsPowerShellâ. Next create a file called âMicrosoft.PowerShell_profile.ps1â. This file will be called first whenever you open powershell, and itâs where we can add commands to customize things a bit.
(270) 350-3325Working Directory
The first thing I like to do is to create a new default working directory for powershell. By default, powershell opens into your user profile, but if you run it as admin, it will open up to system32. Iâve created a new folder called âtempâ in my User folder that I use as a scratch working space. Now, we can set this as the default directory by adding the following line to our profile:
Next, I have a folder full of miscellaneous script that I like to use regularly. To make it easier to call these, I add my scripts folder to my path. This example is using a scripts folder in your WindowsPowerShell folder.
$env:path += ";$home/Documents/WindowsPowerShell/scripts"
Last up, I set up some aliases for commands I use commonly. For instance, Iâll shave a few keystrokes off my nslookups by aliasing it to simply ânsâ
Set-Alias ns nslookup
urorrheaPutting it all Together
With those three lines added, our Microsoft.PowerShell_profile.ps1 should look something like this: