Wednesday, January 11, 2012

My Powershell Profile

I updated my profile in .\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 to include SharePoint:

function prompt {
$Host.UI.RawUI.WindowTitle=$(get-location)
"$ ";
}

#Set environment variables for Visual Studio Command Prompt
pushd 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC'
cmd /c "vcvarsall.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
write-host "`nVisual Studio 2010 Command Prompt variables set." -ForegroundColor Yellow

& ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1'
write-host "`nSharePoint environment set." -ForegroundColor Yellow