Powershell Profile

Here is a quick and dirty way to create a Powershell profile.

First, start the Powershell terminal and type:


new-item $profile -Force
notepad $profile

An empty profile file appears, and you can type the commands you want to run at start up:

cd ~/Documents

Fortune cookie

If you want to be greeted with a fortune cookie, add the following line:

$fc = ((Invoke-WebRequest https://gdgnoco-fortune.appspot.com/api/fortune).content) | ConvertFrom-Json
write-host `t `"$($fc.fortune)`"

Thanks to the Google Developers Group Nort Colorado for hosting the api!

Some nice ASCII art

Finally, add a nice ASCII picture to spice up your day. I found one here. Clone the repo and save Get-MOTD.ps1 in your $env:HOMEPATH\Documents\WindowsPowershell\ directory.

Your $profile file will look like this:

. $env:HOMEPATH\Documents\WindowsPowershell\Get-MOTD.ps1
Get-MOTD
write-host ""
write-host ""
$fc = ((Invoke-WebRequest https://gdgnoco-fortune.appspot.com/api/fortune).content) | ConvertFrom-Json
write-host `t `"$($fc.fortune)`"
write-host ""
cd ~

And it if you start the Powershell terminal you will be greeted like this:

2016-04-25 12_57_37-Windows PowerShell

Tip: don’t do this in ISE. Also, install posh-git and follow the profile adjustments described on their github site.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

%d bloggers liken dit: