Skip to content

Instantly share code, notes, and snippets.

@morten-olsen
Last active August 29, 2015 14:22
Show Gist options
  • Save morten-olsen/afdd9e2db9f1bea476d4 to your computer and use it in GitHub Desktop.
Save morten-olsen/afdd9e2db9f1bea476d4 to your computer and use it in GitHub Desktop.
$psPath = ([environment]::getfolderpath("mydocuments") + '\WindowsPowerShell')
$modulePath = $psPath + '\Modules'
$modulePathExists = Test-Path $modulePath
if ($modulePathExists -eq $false)
{
New-Item $modulePath -type directory
}
$modulesource = 'https://gist.githubusercontent.com/mortenolsendk/afdd9e2db9f1bea476d4/raw/modules.ps1'
$moduledestination = $psPath + '\modules.txt'
Invoke-WebRequest $modulesource -OutFile $moduledestination
$source = 'https://gist.githubusercontent.com/mortenolsendk/afdd9e2db9f1bea476d4/raw/profile.ps1'
$destination = $psPath + '\profile.ps1'
Invoke-WebRequest $source -OutFile $destination
invoke-expression -Command $destination
$wc = New-Object Net.WebClient
$wc.CachePolicy = New-Object System.Net.Cache.HttpRequestCachePolicy([System.Net.Cache.HttpRequestCacheLevel]::NoCacheNoStore)
$wc.DownloadString('https://gist.githubusercontent.com/mortenolsendk/afdd9e2db9f1bea476d4/raw/get.ps1') | iex
(New-Object Net.WebClient).DownloadString('https://gist.githubusercontent.com/mortenolsendk/afdd9e2db9f1bea476d4/raw/get.ps1') | iex
PSReadline
go
posh-git
posh-npm
PowerLS
PsUrl
WiFi-Password
$msBuildPath = "$env:SystemRoot\Microsoft.NET\Framework\v4.0.30319"
$gitPath = Test-Path ("C:\Program Files (x86)\Git\bin\git.exe")
if ($gitPath -eq $True) {
Set-Alias git "C:\Program Files (x86)\Git\bin\git.exe"
}
Set-Alias pls PowerLS
$sublPath = Test-Path ($env:ProgramFiles + "\Sublime Text 3\sublime_text.exe")
if ($sublPath -eq $True)
{
Set-Alias subl ($env:ProgramFiles + "\Sublime Text 3\sublime_text.exe")
}
else
{
$sublPath = Test-Path (${env:ProgramFiles(x86)} + "\Sublime Text 3\sublime_text.exe")
if ($sublPath -eq $True)
{
Set-Alias subl (${env:ProgramFiles(x86)} + "\Sublime Text 3\sublime_text.exe")
}
}
function initModules
{
if ($host.Name -eq 'ConsoleHost')
{
$modulePath = ([environment]::getfolderpath("mydocuments") + '\WindowsPowerShell\Modules.txt')
$modules = Get-Content ($modulePath)
$hasPSGet = Test-Path ([environment]::getfolderpath("mydocuments") + '\WindowsPowerShell\Modules\PSGet')
if ($hasPSGet -eq $False)
{
(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
}
Import-Module PsGet
foreach ($module in $modules) {
$dirExists = Test-Path ([environment]::getfolderpath("mydocuments") + '\WindowsPowerShell\Modules\' + $module)
if ($dirExists -eq $False)
{
Install-Module $module
}
Import-Module $module
}
}
echo "Hello Commander"
cd "$env:homepath"
}
initModules
function global:prompt {
$realLASTEXITCODE = $LASTEXITCODE
Write-Host($pwd.ProviderPath) -nonewline
Write-VcsStatus
$global:LASTEXITCODE = $realLASTEXITCODE
return "> "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment