About Me

Having 12 years experience in Microsoft technologies.Since more than 7 years working in SharePoint technologies. Expert in providing consultation for SharePoint projects. Hands on with development and administration.

Tuesday, 22 January 2013

Naming conventions/format for various SharePoint 2010 components


As a Architect/Admin, in a day to day activities we are supposed to follow few standards to create SP components like
Service accounts
Web Applications
Service applications
Application pools
Content DBs
Solution Packages
Service accounts
Example – SPSVCQADMIN where SP stands for – SharePoint, SVC stands for Service account, Q stands for QA. Likewise we will use same format for DEV & Production as well by replacing Q with D & P respectively. And password should be different for each account.

 

Wednesday, 19 December 2012

PowerShell script to deploy Multiple Sandbox solutions

Applies to SPFoundation 2010, SP 2010, SPFoundation 2013,SP 2013

Points to be noted:
1. Replace $siteURL with url
2. All wsps should be in the current directory of the script (.ps1)

Add-PsSnapin Microsoft.SharePoint.PowerShell
$logfile=$CurrentDir + "\log.log"
$siteURL = "
xxxxxxx"
Start-Transcript $logfile
#Do not modify anything in the script from here onwards
function Get-ScriptDirectory
{
 $Invocation = (Get-Variable MyInvocation -Scope 1).Value
 Split-Path $Invocation.MyCommand.Path
}

function Deploy-Solution{
param(
[string]$physicalPath,
[string]$name)

$SolutionName = $name
$SolutionPath = Join-Path ($physicalPath) $SolutionName
echo "Extracting information from $physicalPath"

$Solution = Get-SPUserSolution -site $siteURL | Where { ($SolutionName -eq $_.Name) }  -ErrorAction SilentlyContinue
if ($Solution -ne $null)
{
    if($Solution.Status -eq "Activated")
    {
    Write-Host 'Poweshell Script will now retract solution:' $SolutionName
    Uninstall-SPUserSolution -Identity $SolutionName -Site $SiteURL -Confirm:$false
    Write-Host 'Successfully retracted solution:' $SolutionName
    }
    Write-Host 'Removing Solution:' $SolutionName
    Remove-SPUserSolution -Identity $SolutionName -Site $siteURL -Confirm:$false
    Write-Host 'Successfully removed Solution:' $SolutionName
}

Write-Host 'Poweshell Script will now add solution:' $SolutionName
Add-SPUserSolution –LiteralPath $SolutionPath -Site $SiteURL
Write-Host 'Poweshell Script will now deploy solution:' $SolutionName
Install-SPUserSolution -Identity $SolutionName -Site $SiteURL
Write-Host 'Poweshell Script has finished deployment of solution:' $SolutionName
}

#Get Current Physical Path
$currentPhysicalPath = Get-ScriptDirectory

#Iterate through all .wsp files in the current Physical Path to deploy solution
get-childitem $currentPhysicalPath -include *.wsp -recurse | foreach ($_) {Deploy-Solution $currentPhysicalPath $_.name}

Stop-Transcript
#Remove SharePoint Snapin
Remove-PsSnapin Microsoft.SharePoint.PowerShell


Echo Finish