Skip to content

Instantly share code, notes, and snippets.

@brian-pickens
Last active July 30, 2021 19:01
Show Gist options
  • Save brian-pickens/3efe3dd6ae190a1cfa5eb236b84852f4 to your computer and use it in GitHub Desktop.
Save brian-pickens/3efe3dd6ae190a1cfa5eb236b84852f4 to your computer and use it in GitHub Desktop.
My Powershell Profile

Install Themes

Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

Profile.ps1

##---------------------------------------
## Theming
##---------------------------------------
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme pure

##---------------------------------------
## Functions
##---------------------------------------
function Start-ElevatedProcess {
    param (
        [string]$ExePath,
        [string]$StartPath
    )
    Start-Process -FilePath $ExePath -ArgumentList $StartPath -Verb RunAs 
}

function Edit-Hosts {
    Start-ElevatedProcess notepad.exe C:\Windows\System32\drivers\etc\hosts
}

function Get-Version {
    $PSVersionTable.PSVersion
}

##---------------------------------------
## Aliases
##---------------------------------------
Set-Alias elevate Start-ElevatedProcess
Set-Alias hosts Edit-Hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment