Month: February 2014

Export/Import of SharePoint 2010 site using Power Shell


Hello again
I usually backup and restore the whole site collection via these commands:

1)Backup-SPSite -Identity -Path [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]

2) Restore-SPSite -Identity -Path [-DatabaseServer ] [-DatabaseName ] [-HostHeader ] [-Force] [-GradualDelete] [-Verbose]

but today i am going to show you how to import the web only:
1) Start by lunching SharePoint 2010 Management Shell, you will get a Power shell command prompt like below:
2
2) type this command “Export-SPWeb -Identity http:\\ServerName:port\Site -Path c:\\backup\Exportback.dat”

3

The NoFileCompression parameter lets you specify that no file compression is performed during the export process. Using this parameter can lower resource usage up to 30% during the export process. Using this parameter will result in a backup folder being created instead of a compressed file. If you use the NoFileCompression parameter in the Export-SPWeb command, you must also use it when you import the content by using the Import-SPWeb command.

3)To import to a site you have to use Import-SPWeb command, The complete command is

Import-SPWeb -Identity http:\\ServerName:port\Site -Path c:\\backup\Exportback.dat -Force

I have used -force to over write the existing site in my destination

4

SharePoint 2010 – 2013 PreUpgradeCheck


Hello

For those of you who migrated projects from 2007 to 2010, you must admit that “stsadm.exe -o preupgradecheck” is awesome !!!

For those who don’t know what i am talking about, “stsadm.exe -o preupgradecheck” gives you information about possible issues upgrading your 2007 farm to 2010.

And now that i am starting to upgrade to SharePoint 2013, I have noticed ( to my horor) that the pre-upgrade feature is missing from SharePoint 2010 😦 .

Surfing the net i found a fairly basic PowerShell script that can give you some of the same information the old “preupgradecheck” option gave you. Information like what your farm’s build number is, what templates you have and what web uses which template, database sizes, solutions installed in the farm, etc.

If you felt like it you would be able to get most of this information by digging around in Central Administration, SQL Management studio,  the SharePoint settings pages, or SharePoint designer, but this script may save you a little time. The script won’t tell you anything specific about the problems you may have upgrading to 2013, it just gives you all the information in one place to use as a reference. I hope you find it to useful.

No Warranty Expressed or Implied. Use with caution (that applies to all PowerShell written by some random person on the internet).

 

#Copy this text into a text document and save it as InfoScript.ps1
#Please login to your SharePoint server using an account that has permissions to run PowerShell Commands.
 # Place the file InfoScript.ps1 into a directory on the server that hosts SharePoint Central Administration.
 # Open the SharePoint 2010 Management Shell and type:
 # c:\[directory where you placed the script]\InfoScript2010.ps1 | Out-File -width 200 c:\InfoOutput.txt
 # The "Out-File -width 200" part of the command is to make the output wider to fit more information on each line
 # Once the script has completed, please forward the InfoOutput.txt file to your Rackspace contact via email.
 #|
 #
add-pssnapin microsoft.sharepoint.powershell -ea 0
$scriptuser = whoami
 write-output "InfoScript was run under account name","------------------------------------", $scriptuser
write-output "Servers in farm, their upgrade status and version number (version is just for comparison)"
 # Added bit to weed out SQL and email servers
 Get-SPServer | Where-Object { $_.role -ne "invalid" } | Select Name, Role, NeedsUpgrade, Version | out-string -width 200
 write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Web Apps in Farm and if they are using claims auth or not"
Get-SPWebApplication |select DisplayName, URL, @{Label = "Claims Enabled?"; Expression = {$_.UseClaimsAuthentication}} |out-string -width 200
write-output "SharePoint Farm Build number"
 Get-SPFarm | Select BuildVersion | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Solutions in Farm"
 Get-SPSolution | select Displayname, deployed, DeployedWebApplications | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Site Collections by DB"
 Get-SPContentDatabase | %{Write-Output "`nDatabase: $($_.Name)"; ForEach($site in $_.sites){write-Output ("`t " + $site.url)}}| out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Database sizes"
 Get-SPDatabase |Sort Name| select Name, @{Label = "DB Size in MB"; Expression = {"{0:N2} MB" -f ($_.DiskSizeRequired/1048576)}}, Type, Id | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "SiteCollection size estimates (very rough)"
 Get-SPSite | Select URL, @{Label="Storage"; Expression={"{0:N2} MB" -f ($_.Usage.Storage/1048576)}} | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "AAM Info"
 Get-SPAlternateURL
 write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Features in Farm"
 Get-SPFeature -Limit all | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Templates in Farm"
Get-SPWebTemplate | out-string -width 200
 write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Template USED in farm by web" " "
Write-Host -foregroundcolor yellow "The final step in this script will list every web (site or subsite)
 in your farm along with the template used by that web.
If you have a large number of sites it might take some time to complete and use a lot of resources.
All the other information collected by this script has already been placed in a file,

 so if you answer no, only this step will be skipped."
$continue = Read-Host "Would you like to continue? (Y/N)"
 if($continue -eq "Y")
 {
 get-spsite -limit all | get-spweb -limit all |select URL, @{Label = "Template"; Expression = { $_.WebTemplate}}, @{Label = "TemplateID"; Expression = { $_.WebTemplateID}} | out-string -width 200
 }
 

 

 

Step by Step – Patching SharePoint 2010 RTM VM with latest Service Packs and CUs


Step by Step – Patching SharePoint 2010 RTM VM with latest Service Packs and CUs
useful advice

Microsoft Cloud with Nik Patel

I wanted to post this article for a while. This is mainly as my own self note.

I have upgraded my SharePoint 2010 RTM VM to SharePoint 2010 SP1 and February 2012 CU last April. Since I have many VMs with many snapshots, many times I have to go through same patching process again and again and I have to ensure I have been installing software in the right order. Many times I ask myself same questions again and again – Do I need to install SharePoint Foundation SP1? Do I need to run SharePoint Configuration wizard every time I install SP1 or CU or running SharePoint configuration wizard only once as last step would be sufficient?

Instead of going through same process again and again, In this walk through, I am going to document patching Single Server Farm – SharePoint Server RTM VM with SharePoint Server SP1 and SharePoint Server…

View original post 479 more words