Skip to content

Instantly share code, notes, and snippets.

@mirontoli
Last active November 17, 2016 19:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirontoli/8471250 to your computer and use it in GitHub Desktop.
Save mirontoli/8471250 to your computer and use it in GitHub Desktop.
PowerShell Profile: ~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1http://sharepoint.stackexchange.com/questions/15102/automatically-add-pssnapin-microsoft-sharepoint-powershell
if (!(Test-Path $profile)) {
New-Item $profile -Type File -Force
}
#Clear-Host
#asnp *share*
function prompt {
Write-Host -NoNewLine -ForegroundColor White "["
Write-Host ([Environment]::UserName + "@" +
[Environment]::MachineName + "." +
[Environment]::UserDomainName) -NoNewLine -ForegroundColor Cyan
Write-Host -NoNewLine -ForegroundColor White "::"
Write-Host -NoNewLine $(Resolve-Path .) -ForegroundColor Green
Write-Host -NoNewLine -ForegroundColor White "]"
Write-Host -ForegroundColor Magenta "$"
return "> "
}
function script:SetUIPreferences() {
$rawui = $host.UI.RawUI
$rawui.ForegroundColor = "white"
$rawui.BackgroundColor = "DarkBlue"
$rawui.WindowTitle = "Term"
}
function Start-Browser {
Param(
[Parameter(Mandatory=$true)]
[string] $Url,
[String] $Username,
[ValidateSet("IE","Chrome","Firefox")][string]$Browser = "IE"
)
$additionalParams = @{}
if ($username) {
$cred = Get-Credential -UserName $Username -Message "Open IE as $Username"
$additionalParams.Add("Credential", $cred)
}
$paths = @{
"IE" = "Internet Explorer\iexplore.exe"
"Chrome" = "Google\Chrome\Application\chrome.exe"
"Firefox" = "Mozilla Firefox\firefox.exe"
}
$browserPath = Resolve-Path "${env:ProgramFiles(x86)}\$($paths[$Browser])"
Start-Process @additionalParams $browserPath $Url
}
Set-Alias subl "C:\Program Files\Sublime Text 3\sublime_text.exe"
#cd ~
SetUIPreferences
#setup Git
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
sasv SPSearchHostController -WarningAction Ignore
sasv SPTimerV4 -WarningAction Ignore
sasv FIMService -WarningAction Ignore
sasv FIMSynchronizationService -WarningAction Ignore
sasv AppFabricCachingService -WarningAction Ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment