Subscribe:

Labels

Wednesday, September 18, 2013

Start Web App Pools using Power shell command

Import-Module WebAdministration
cd IIS:/AppPools
$ApplicationPools = dir
foreach ($item in $ApplicationPools)
{
    $ApplicationPoolName = $item.Name
    $ApplicationPoolStatus = Get-WebAppPoolState $ApplicationPoolName
        if($ApplicationPoolStatus.Value -eq "Stopped")
            {
                     #Write-Host $ApplicationPoolName -->
                      $ApplicationPoolStatus.Value
                      Write-Host $ApplicationPoolName "found stopped."
                      Start-WebAppPool -Name $ApplicationPoolName
                      Write-Host $ApplicationPoolName "started."
            }
}

Friday, July 26, 2013

Content DataBase Migration from SharePoint 2010 to SharePoint 2013

  
DB Migration from sharepoint 2010 to sharepoint 2013

1.       Use Farm Admin Account For the Installation
2.        Check the Windows 2008 R2 SP1 (using Winver in the RunPrompt) or windows2012 server
3.       Run PreUpgradechecker.(Present in the SharePoint 2013 Installation Wizard)









Click on Finish on Prerequisites and it will Restart your computer.

4.       Get the  4 KB’s from the following link and Install one-by-one

Install the KB 2554876 
           Install KB 2708075

          Install KB 2759112
         Install the KB 2765317

5.      5.  Install SharePoint

         Run SharePoint set up


Right Click on Prerequisites and click on Run as administrator 
Right Click Run As Administrator





6.Configure SharePoint Farm Using PowerShell

############################################################
# Configure-SPFarm.ps1
# Configures a SharePoint 2013 farm with:
# Configuration Database
# Central Administration web application and site
#
#
############################################################
# Service accounts
$DOMAIN = "Domain"
$accounts = @{}
$accounts.Add("SPFarm", @{"username" = "user account"; "password" = "pwd"})
$accounts.Add("SPWebApp", @{"username" = "user account"; "password" = "pwd"})
$accounts.Add("SPSvcApp", @{"username" = "user account"; "password" = "pwd"})
Foreach ($account in $accounts.keys) {
$accounts.$account.Add(`
"credential", `
(New-Object System.Management.Automation.PSCredential ($DOMAIN + "\" + $accounts.$account.username), `
(ConvertTo-SecureString -String $accounts.$account.password -AsPlainText -Force)))
}
# SQL Server client alias
#This is the name of SQL Alias
$AliasName = "SPFarmAlias"
#This is the name of your SQL server (the actual name!)
# In this case we're using the current computer name as we are assuming #SharePoint and SQL are on the same server
# Change this if this isn't the case in your environment!
$ServerName = $env:devshpt31
#These are the two Registry locations for the SQL Alias locations
$x86 = "HKLM:\Software\Microsoft\MSSQLServer\Client\ConnectTo"
$x64 = "HKLM:\Software\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo"
#We're going to see if the ConnectTo key already exists, and create it if it doesn't.
if ((test-path -path $x86) -ne $True)
{
write-host "$x86 doesn't exist"
New-Item $x86
}
if ((test-path -path $x64) -ne $True)
{
write-host "$x64 doesn't exist"
New-Item $x64
}
#Adding the extra "fluff" to tell the machine what type of alias it is
$TCPAlias = ("DBMSSOCN," + $ServerName)
#Creating our TCP/IP Aliases
New-ItemProperty -Path $x86 -Name $AliasName -PropertyType String -Value $TCPAlias
New-ItemProperty -Path $x64 -Name $AliasName -PropertyType String -Value $TCPAlias
# Open cliconfig to verify the aliases
Start-Process C:\Windows\System32\cliconfg.exe
Start-Process C:\Windows\SysWOW64\cliconfg.exe
# Farm configuration
$configPassphrase = "SharePoint 2013 Intranet!"
$s_configPassphrase = (ConvertTo-SecureString -String $configPassphrase -AsPlainText -force)
$serverDB = $AliasName
$dbConfig = "SP2013_Configuration"
$dbCentralAdmin = "SP2013_Content_CentralAdministration"
$caPort = 55555
$caAuthProvider = "NTLM"
########################################
# Create the farm
Add-PSSnapin Microsoft.SharePoint.PowerShell
Write-Output "Creating the configuration database $dbConfig"
New-SPConfigurationDatabase `
-DatabaseName $dbConfig `
-DatabaseServer $serverDB `
-AdministrationContentDatabaseName $dbCentralAdmin `
-Passphrase $s_configPassphrase `
-FarmCredentials $accounts.SPFarm.credential
# Check to make sure the farm exists and is running. if not, end the script
$farm = Get-SPFarm
if (!$farm -or $farm.Status -ne "Online") {
Write-Output "Farm was not created or is not running"
exit
}
Write-Output "Create the Central Administration site on port $caPort"
New-SPCentralAdministration `
-Port $caPort `
-WindowsAuthProvider $caAuthProvider
# Perform the config wizard tasks
Write-Output "Install Help Collections"
Install-SPHelpCollection -All
Write-Output "Initialize security"
Initialize-SPResourceSecurity
Write-Output "Install services"
Install-SPService
Write-Output "Register features"
Install-SPFeature -AllExistingFeatures
Write-Output "Install Application Content"
Install-SPApplicationContent
# Add managed accounts
Write-Output "Creating managed accounts ..."
New-SPManagedAccount -credential $accounts.SPWebApp.credential
New-SPManagedAccount -credential $accounts.SPSvcApp.credential
New-SPManagedAccount -credential $accounts.SPCrawl.credential
#Start Central Administration
Write-Output "Starting Central Administration"
& 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN\psconfigui.exe' -cmd showcentraladmin
Write-Output "Farm build complete."


7.Service Applications Configuration using the Powershell


Start the service instances

The following procedures start the service instances.

To start service application instances from Central Administration

       I.            Start SharePoint 2013 Central Administration.
o    For Windows Server 2008 R2:
§  Click Start, click Microsoft SharePoint 2013 Products, and then click SharePoint 2013 Central Administration.
o    For Windows Server 2012:
§  On the Start screen, click SharePoint 2013 Central Administration.
If SharePoint 2013 Central Administration is not on the Start screen:
§  Right-click Computer, click All apps, and then click SharePoint 2013 Central Administration.
For more information about how to interact with Windows Server 2012, see Common Management Tasks and Navigation in Windows Server 2012.
    II.            In SharePoint 2013 Central Administration, on the Application Management page, in the Service Applications section, click Manage Services on Server.
 III.            Next to the Business Data Connectivity service, click Start.
 IV.            Next to the Managed Metadata Web Service, click Start.
    V.            Next to the PerformancePoint Services service, click Start.
 VI.            Next to the Secure Store Service, click Start.
VII.            Next to the User Profile Service, click Start.
8. The Search service instance must be started by using Windows PowerShell because you cannot start it from Central Administration unless a Search Service application already exists.
To start the Search service instance by using Windows PowerShell

Add-PSSnapin Microsoft.SharePoint.Powershell
$SearchInst = Get-SPEnterpriseSearchServiceInstance
# Stores the identity for the Search service instance on this server as a variable
Start-SPServiceInstance $SearchInst

 9. start the service instances using power shell commands follow the below commands


# Starts the service instance
Add-PSSnapin Microsoft.SharePoint.Powershell
#Upgrade Secure Store Service
$applicationPool = Get-SPServiceApplicationPool -Identity "SharePoint Web Services System"
$sss = New-SPSecureStoreServiceApplication -Name 'Secure Store Service' -ApplicationPool $applicationPool -DatabaseName 'Secure_Store_Service_DB' –AuditingEnabled
$sssp = New-SPSecureStoreServiceApplicationProxy -Name SPSecureStoreProxy -ServiceApplication $sss –DefaultProxyGroup
Update-SPSecureStoreMasterKey -Passphrase "Republ1c1" -ServiceApplicationProxy $sssp
Start-Sleep 5
Update-SPSecureStoreApplicationServerKey -Passphrase "Republ1c1" -ServiceApplicationProxy $sssp
Start-Sleep 5

#Upgrade BDS Service
$applicationPool = Get-SPServiceApplicationPool -Identity 'SharePoint Web Services System'
New-SPBusinessDataCatalogServiceApplication -Name 'BDC Service' -ApplicationPool $applicationPool -DatabaseName 'Bdc_Service_DB_df53d6bd850b46f7b58130f35ac23f28'

#Upgrade the Managed Metadata service application
$applicationPool = Get-SPServiceApplicationPool -Identity 'SharePoint Web Services System'
$mms = New-SPMetadataServiceApplication -Name 'Managed Metadata Service Application' -ApplicationPool $applicationPool -DatabaseName 'ManagedMetadata'
New-SPMetadataServiceApplicationProxy -Name 'ManagedMetadataProxy' -ServiceApplication $mms -DefaultProxyGroup


#Upgrade the User Profile service application
$applicationPool = Get-SPServiceApplicationPool -Identity 'SharePoint Web Services System'
$upa = New-SPProfileServiceApplication -Name 'User Profile Service Application' -ApplicationPool $applicationPool -ProfileDBName 'Profile_DB' -SocialDBName 'Social_DB' -ProfileSyncDBName 'Sync_DB'
New-SPProfileServiceApplicationProxy -Name 'UserProfileServiceProxy' -ServiceApplication $upa -DefaultProxyGroup

#Upgrade the PerformancePoint Services service application
$applicationPool = Get-SPServiceApplicationPool -Identity 'SharePoint Web Services System'
$pps = New-SPPerformancePointServiceApplication -Name 'PerformancePoint Service' -ApplicationPool $applicationPool -DatabaseName 'PerformancePoint Service Application_42130b2b01484fe79461506442afb46e'
New-SPPerformancePointServiceApplicationProxy -Name 'PerformancePointProxy' -ServiceApplication $pps -Default

#Upgrade the Search service application

$applicationPool = Get-SPServiceApplicationPool -Identity 'SharePoint Web Services System'

$searchInst = Get-SPEnterpriseSearchServiceInstance -local
# Gets the Search service instance and sets a variable to use in the next command

Restore-SPEnterpriseSearchServiceApplication -Name 'SP2013_SearchServiceApplication' -applicationpool $applicationPool -databasename 'FASTContent_DB_0d544f286d044d4a83cf9ba001a2e405' -databaseserver 'devshpt31' -AdminSearchServiceInstance $searchInst
$ssa = Get-SPEnterpriseSearchServiceApplication
New-SPEnterpriseSearchServiceApplicationProxy -Name 'SearchServiceAppProxy' -SearchApplication $ssa
$ssap = Get-SPEnterpriseSearchServiceApplicationProxy
Add-SPServiceApplicationProxyGroupMember –member $ssap -identity " "
#Verify that all of the new proxies are in the default proxy group
$pg = Get-SPServiceApplicationProxyGroup -Identity " "
$pg.Proxies


10. Claims authentication and Classic Authentication: SharePoint 2013 uses Classic authentication

Database Upgrade:
WARNING: The Windows Classic authentication method is deprecated in this release and the default behavior of this cmdlet, which creates Windows Classic based web application, is obsolete. It i
s recommended to use Claims authentication methods. You can create a web application that uses Claims authentication method by specifying the AuthenticationProvider parameter set in this cmdle
t. Refer to the http://go.microsoft.com/fwlink/?LinkId=234549 site for more information. Please note that the default behavior of this cmdlet is expected to change in the future release to cre
ate a Claims authentication based web application instead of a Windows Classic based web application.

Resolve the Issue using the following.

Data Base Upgrade

1.     Copy all the dbs from the SP2010 Farm SQL DB Server to SP2013 Farm SQL DB Server

2.     Create all the Web Applications in SP 2013 using the following Powershell
Create all the web applications (with the same url, same port and same name with the dummy db name – something like D
eletethis1, Deletethis2)

Below one is to create web application using classic based authentication.
#test webapp
Add-PSSnapin Microsoft.SharePoint.Powershell
$WebAppName = "test - 26173"
$WebAppHostHeader = "testDevInside2013.com"
$WebAppPort = 80
$WebAppAppPool = "test - 26173"
$URL = "http://testDevInside2013.com"
# This User has to be a Sharepoint Manager Account
$WebAppAppPoolAccount = "microsoft\_dev"
$WebAppDatabaseName = "DeleteThis1"
$WebAppDatabaseServer = "sevsht31"
# Create a new Sharepoint WebApplication
New-SPWebApplication -Name $WebAppName -Port $WebAppPort -HostHeader $WebAppHostHeader -URL $URL -ApplicationPool $WebAppAppPool  -AuthenticationMethod "NTLM" -ApplicationPoolAccount (Get-SPManagedAccount $WebAppAppPoolAccount) -DatabaseName $WebAppDatabaseName -DatabaseServer $WebAppDatabaseServer

For claims based authentication


#test webapp
Add-PSSnapin Microsoft.SharePoint.Powershell
$WebAppName = "test - 5555"
$WebAppHostHeader = "testDevInside2013.com"
$WebAppPort = 80
$WebAppAppPool = "test - 5555"
$URL = "http://testDevInside2013.com"
# This User has to be a Sharepoint Manager Account
$WebAppAppPoolAccount = "microsoft\_dev"
$WebAppDatabaseName = "DeleteThis1"
$WebAppDatabaseServer = "sevsht31"
$ap = New-SPAuthenticationProvider
# Create a new Sharepoint WebApplication
New-SPWebApplication -Name $WebAppName -Port $WebAppPort -HostHeader $WebAppHostHeader -URL $URL -ApplicationPool $WebAppAppPool -AuthenticationMethod "NTLM" -ApplicationPoolAccount (Get-SPManagedAccount $WebAppAppPoolAccount) -DatabaseName $WebAppDatabaseName -DatabaseServer $WebAppDatabaseServer –AuthenticationProvider $ap



11. Get all the .wsp from SharePoint 2010 to SharePoint 2013 using the following Powershell

  Export the wsps from the old farm to the new Form using the powershell script

Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

## setup our output directory
$dirName = "c:\sp2010_wsps"

Write-Host Exporting solutions to $dirName
foreach ($solution in Get-SPSolution)
{
  $id = $Solution.SolutionID
    $title = $Solution.Name
    $filename = $Solution.SolutionFile.Name

    Write-Host "Exporting ‘$title’ to …\$filename" -nonewline
    try {
        $solution.SolutionFile.SaveAs("$dirName\$filename")
        Write-Host " – done" -foreground green
    }
    catch
    {
        Write-Host " – error : $_" -foreground red
    }
}

12 .Install all the .wsps in SP 2013 using the following powershell
Add-PSSnapin Microsoft.SharePoint.Powershell
# areasecuredwp.wsp
Add-SPSolution "C:\Deployments\SharePoint2013\sp2010_wsps\testwp.wsp"
Install-SPSolution –Identity testwp.wsp –WebApplication http://testdevinside2013.com/ -GACDeployment


13.Test the DB Upgrade Customizations errors using the following powershell
Test-SPContentDatabase –Name ‘your db name’ -WebApplication http://www.testdevinside2013.com/
Test-SPContentDatabase –Name ‘your db name’ -WebApplication http://www.xxprojectsdevinside2013.com/
Test-SPContentDatabase –Name ‘your db name’ -WebApplication http://www.yyysdevinside2013.com/

14.Delete the dummy Databases which you created with SP 2013 web apps
Dismount-SPContentDatabase "DeleteThis1"
Dismount-SPContentDatabase "DeleteThis2"
Dismount-SPContentDatabase "DeleteThis3"
Dismount-SPContentDatabase "DeleteThis4"
Dismount-SPContentDatabase "DeleteThis5"
15.Upgrade the web application using the following PowerShell
Mount-SPContentDatabase –Name ‘your db name’  -DatabaseServer ‘your db server name’ -WebApplication http://www.testdevinside2013.com/
Mount-SPContentDatabase –Name ‘your db name’  -DatabaseServer ‘your db server name’ -WebApplication http://www.xxprojectsdevinside2013.com/
Mount-SPContentDatabase –Name ‘your db name’  -DatabaseServer ‘your db server name’ -WebApplication http://www.yyydevinside2013.com/


16.Now access the web applications, you will see all your sites in SP2013 with SP 2010 UI

17. Now Upgrade the Customizations
Custom Master Pages
Custom Page Layouts

Custom Web parts or Custom Controls