Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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