Kernel Data Recovery Blog

How to backup a WSP in a SharePoint server using PowerShell ?

Read time 4 minutes

Summary: A WSP file contains feature updates, new software modules, etc. In this article we will discuss a comprehensive guide to backup WSP in SharePoint server with PowerShell. Additionally, we will explore a SharePoint migration tool, Kernel Migration for SharePoint, capable of handling any data transfer job related to SharePoint.

SharePoint has many advanced features in its environment that are highly important for storing data, optimizing its usage, and accessing it in minimum time. One such important feature is SharePoint Solutions, which are packaged through a solution package (WSP). Such solutions packages can be created through Visual Studio for a better SharePoint organization and creation and deployment of such packages.

What is a solution package?

A solution package combines multiple SharePoint features into a single file and lets you deploy directly to SharePoint Server.

For example: A contact list can contain some elements like list instance and list definition. You can create a separate feature with these elements and save them in a SharePoint Server package (WSP).

Tools to manage & deploy WSP

There are several SharePoint tools to handle the deployment of the SharePoint Server package. The primary ones are listed below:

1. Solution Explorer

The Solution Explorer allows the user to navigate and handle the SharePoint project files. The context menu of solution explorer has special features to add Features, Feature Resources, and Feature event receivers. The user can also open several feature designers and package designers to create, deploy, and manage the packages.

2. Packaging Explorer

The Packaging Explorer is a window tool that collects the SharePoint files into packages. There is a simple hierarchical view of the complete package, project items, features, and files. The essential tasks in the packaging explorer are following-

  1. Open SharePoint projects and files.
  2. Drag & drop SharePoint files, projects and files into the same package.
  3. Drag & drop SharePoint files, projects and files from one package to another.
  4. Add the distinct feature in the package.
  5. Open the package.
  6. Validate package and its features.

3. Feature designer and Package designer

  1. With the help of a feature designer, the user can create features, manage scope, and declare the dependencies in the features. The designer part of the tool shows the final XML file that notifies the description of the feature.
  2. The feature designer sets the scope of the feature to an individual site or a site of collection. When the feature is activated for the single site, then it will work for the single site only. But, when the feature is activated in the site collection, the feature will work on all the sites.
  3. When one feature is dependent on other features, then the tool helps you in activating a feature activation dependency to mention the dependent feature. It helps in identifying the features before making them available for the packages. The feature activation dependency assures that the feature is already activated or not.
  4. With the help of the package designer, the user can group the SharePoint elements in the single WSP package and reset the Web server for deployment.
  5. During the deployment, if the IIS server is stopped from copying the package file to the SharePoint Server, the Package Designer helps you decide when to restart the IIS Server back again.

With the help of all these tools, you can create the WSP files and use them accordingly. These packages will have complete information on the features and the functionality. It can also contain site services, definitions, and other custom features. You can also download the WSP files and can reuse them again to a different SharePoint account. If you have the backup of the SharePoint account data, then you can go ahead and save the WSP file.

Backup a WSP file in a SharePoint Server

Microsoft SharePoint server WSP backup can be created using simple PowerShell commands. Follow the steps mentioned below to safely backup the WSP in your system.

  1. Login to SharePoint Server and open the SharePoint PowerShell Management tool as the Administrator.
  2. Input the below script-

    $farm = Get-SPFarm
    $file = $farm.Solutions.Item(“SolutionPackage.wsp”).SolutionFile
    $file.SaveAs(“c:\fullpath\SolutionPackage.wsp”)

    Note: You can get the complete path of the Solution package at the Solution Management of Central Administration page.

How to migrate SharePoint?

The SharePoint admins often have to deal with complex jobs like SharePoint tenant to tenant migration. Such migrations include multiple complex tasks. Therefore, to ensure a smooth transfer of all data items, experts recommend creating a checklist for SharePoint migration. Apart from a process guide, you will also benefit from a professional migration tool.

Kernel Migration for SharePoint is one such tool capable of handling data migration and backups. The SharePoint migration tool includes filters that allow users for a selective data migration. This robust tool surpasses the native SharePoint migration tool SPMT tool from Microsoft. With Kernel migration tool, you can perform migrations like SharePoint 2010 to SharePoint 2019, which is not possible with the native tool and methods.

The tool ensures complete data integrity and preserves original file/folder structure. To decrease your burden, you can also migrate SharePoint permissions with the tool.

Conclusion

Apart from WSP, you can also backup SharePoint site collections with PowerShell. Use the above-discussed commands to securely backup WSP. Backups & migration are common scenarios with a tool as crucial as SharePoint. Therefore, if you need to migrate SharePoint site collections between different databases or do anything related to migration, employ Kernel Migration for SharePoint. A demo version of the tool is also available, download it and try its unique features yourself.

FAQs

Q- What is a WSP file?

A- A WSP file or Windows Solution Package in a SharePoint environment is a compressed file that consolidates features, site templates, assemblies, and several other components.

Q- Is it possible to make modifications to the content of a WSP file?

A- Once you extract the WSP files (solution components), you can make modifications to site templates, assemblies, configuration files, and others as you need.

Q- What to consider while you backup a WSP file in a SharePoint server?

A- When you perform a WSP backup, it’s important to verify that you have all the necessary permissions assigned to execute backups and have enough disk space to store the backup files.

Q- What to do if I encounter errors during back up of .wsp files?

A- If due to any reason, you encounter any errors during the backup process of a .wsp file, try troubleshooting them by analyse the message displaying error in detail. Checking system logs and verifying that you’ve met all the requirements is also a notable step. However, if you still are unable to do that migrate to SharPoint using Kernel Migration for SharePoint, an efficient tool that performs SharePoint migration.

Q- How do I verify if the backup was completed?

A- Once you run the PowerShell script to perform a backup, you’ll see the progress and completion summary mentioned in the end. You can also check the success of the backup process at the location mentioned in the Directory parameter. This will show you the WSP files backed up successfully at the given destination.