Export SharePoint solution packages from your environment

Hi,

I created a script that might help someone out there who wants to backup their SharePoint solution packages. This script is able to export specific solutions or all if no solution names are passed to the script.

Sample script calling for specific solutions:

.\script.ps1 –Solutions MYWSPNUM1.wsp,MYWSPNUM2.wsp

Or if you want to export all available solutions then simply call the script without any parameters:

.\script.ps1

# Get Script params, in this case solution names to the -Solution attribute. Separate solutions names by , char
param([String[]] $Solutions)

Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

#==================================================================================
# Functions definitions
#==================================================================================

#———————————————————————————-
# This function will export all available solutions in your environment
#———————————————————————————-
function ExportAllSolutions
{
$location = get-location
Write-Host Exporting all available solutions to: $location
foreach ($solution in Get-SPSolution)
{
$id = $Solution.SolutionID
$title = $Solution.Name
$filename = $Solution.SolutionFile.Name

try {
$solution.SolutionFile.SaveAs(“$(get-location)\$filename”)
Write-Host “Exported solution package – ‘$title’:” -foreground green
}
catch
{
Write-Host ” Error with solution package – ‘$title’: $_” -foreground red
}
}
}

#———————————————————————————-
# This Function will export a single solution by solution name
#———————————————————————————-
function ExportSolution
{
param([String] $solutionName)
$location = get-location
Write-Host Exporting solution to: $location
$Solution = Get-SPSolution -Identity $solutionName

$id = $Solution.SolutionID
$title = $Solution.Name
$filename = $Solution.SolutionFile.Name

try {
$solution.SolutionFile.SaveAs(“$(get-location)\$filename”)
Write-Host “Exported solution package – ‘$title’:” -foreground green
}
catch
{
Write-Host ” Error with solution package – ‘$title’: $_” -foreground red
}

}

#==================================================================================
# End of function definitions
#==================================================================================

#==================================================================================
# Main operations for the script
#==================================================================================

# If solutions names are passed then export only those solutions
if($Solutions.count -gt 0)
{
foreach ($solutionName in $Solutions)
{
Write-Host $solutionName
ExportSolution $solutionName
}
}
# If no solultions passed then export all solutions
else
{
ExportAllSolutions
}
#==================================================================================
# End of main operations
#==================================================================================

Advertisements

Sharepoint: Hide alternative text from webparts with JQuery

Hi,

This is a rather simple tip for those who might want to hide the alternative text from their webparts header. Add the following to your javascript file that is included into your environment:

$j(“.ms-WPTitle”).attr(“title”, “”);

What it does is simple. Searches for a class named ms-WPTitle that exist in the sharepoint webparts header. Then replaces all title attributes with an empty text.

Good to know: SQL Server 2012 – Part 1

Hi,

It’s been awhile since my last post but here comes my next one on SQL Server. I been gathering SQL Server related links that might come in handy on the most important topics( that I know 🙂 ). Anyway here are the links. Hope it helps some one, enjoy :).

ALTER INDEX (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188388.aspx
ALTER TABLE (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms190273.aspx
ALTER VIEW (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms173846.aspx
binary and varbinary (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188362.aspx
Built-in Functions (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms174318%28v%3DSQL.110%29.aspx
Clustered and Nonclustered Indexes Described http://technet.microsoft.com/en-us/library/ms190457.aspx
COLUMNS_UPDATED (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms186329.aspx
Contained Databases http://msdn.microsoft.com/en-us/library/ff929071.aspx
CONTAINS (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187787.aspx
Create Foreign Key Relationships http://msdn.microsoft.com/en-us/library/ms189049.aspx
CREATE FUNCTION (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms186755.aspx
CREATE INDEX (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188783.aspx
Create Indexed Views http://msdn.microsoft.com/en-us/library/ms191432.aspx
CREATE PROCEDURE (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187926.aspx
CREATE SEQUENCE (Transact-SQL) http://msdn.microsoft.com/en-us/library/ff878091.aspx
CREATE SYNONYM (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms177544.aspx
CREATE TABLE (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms174979.aspx
CREATE VIEW (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187956.aspx
CREATE XML SCHEMA COLLECTION (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms176009.aspx
Data Compression http://msdn.microsoft.com/en-us/library/cc280449.aspx
Data Type Precedence (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms190309.aspx
Data Types (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187752(v=SQL.110).aspx
Database Engine Error Severities http://msdn.microsoft.com/en-us/library/ms164086.aspx
Date and Time Data Types and Functions http://msdn.microsoft.com/en-us/library/ms186724%28v%3DSQL.110%29.aspx
Date and Time Data Types and Functions (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms186724
Date and Time Types http://msdn.microsoft.com/en-us/library/ff848733.aspx
DATEADD (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms186819.aspx
datetimeoffset (Transact-SQL) http://msdn.microsoft.com/en-us/library/bb630289.aspx
DECLARE CURSOR (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms180169.aspx
Detecting and Ending Deadlocks http://msdn.microsoft.com/en-us/library/ms178104%28SQL.105%29.aspx
Deterministic and Nondeterministic Functions http://msdn.microsoft.com/en-us/library/ms178091.aspx
Difference Between Union vs. Union All – Optimal Performance Comparison http://blog.sqlauthority.com/2009/03/11/sql-server-difference-between-union-vs-union-all-optimal-performance-comparison/
Diving into T-SQL Grouping Sets http://www.grapefruitmoon.net/diving-into-t-sql-grouping-sets/
Dynamic Management Views and Functions (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188754.aspx
ENCRYPTBYCERT (Transact-SQL) http://technet.microsoft.com/en-us/library/ms188061.aspx
ENCRYPTBYPASSPHRASE (Transact-SQL) http://technet.microsoft.com/en-us/library/ms190357.aspx
EOMONTH (Transact-SQL) http://msdn.microsoft.com/en-us/library/hh213020.aspx
Example @@ERROR (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188790.aspx
Example @@TRANCOUNT (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187967.aspx
Example: Retrieving Product Model Information as XML http://msdn.microsoft.com/en-us/library/bb510464.aspx
EXCEPT and INTERSECT (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188055.aspx
EXECUTE AS Clause (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188354.aspx
Executing Remote Stored Procedure – Calling Stored Procedure on Linked Server http://blog.sqlauthority.com/2007/10/06/sql-server-executing-remote-stored-procedure-calling-stored-procedure-on-linked-server/
Features Supported by the Editions of SQL Server 2012 http://msdn.microsoft.com/en-us/library/cc645993(SQL.110).aspx
FileTables (SQL Server) http://msdn.microsoft.com/en-us/library/ff929144.aspx
FOR XML (SQL Server) http://msdn.microsoft.com/en-us/library/ms178107.aspx
FORMAT (Transact-SQL) http://msdn.microsoft.com/en-us/library/hh213505.aspx
Formatting Types http://msdn.microsoft.com/en-us/library/26etazsy.aspx
FROM (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms177634.aspx
Graphical Execution Plan Icons (SQL Server Management Studio) http://msdn.microsoft.com/en-us/library/ms175913%28v%3DSQL.105%29.aspx
GROUP BY (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms177673.aspx
Hardware and Software Requirements for Installing SQL Server 2012 http://msdn.microsoft.com/en-us/library/ms143506
IN (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms177682.aspx
Join Hints (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms173815.aspx
LAG (Transact-SQL) http://msdn.microsoft.com/en-us/library/hh231256.aspx
LEAD (Transact-SQL) http://msdn.microsoft.com/en-us/library/hh213125.aspx
LIKE (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms179859
Locking Hints http://technet.microsoft.com/en-us/library/ms189857.aspx
MERGE (Transact-SQL) http://technet.microsoft.com/en-us/library/bb510625.aspx
Microsoft Office 2010 Filter Packs http://www.microsoft.com/en-us/download/details.aspx?id=17062
money and smallmoney (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms179882.aspx
optimize for ad hoc workloads Server Configuration Option http://msdn.microsoft.com/en-us/library/cc645587.aspx
OUTPUT Clause (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms177564.aspx
Page Compression Implementation http://msdn.microsoft.com/en-us/library/cc280464.aspx
PATINDEX (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188395
Plan Caching in SQL Server 2008 http://msdn.microsoft.com/en-us/library/ee343986%28SQL.100%29.aspx
Query Hints (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms181714.aspx
Ranking Functions (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms189798.aspx
Row Compression Implementation http://msdn.microsoft.com/en-us/library/cc280576.aspx
Search Condition (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms173545.aspx
Semantic Search (SQL Server) http://technet.microsoft.com/en-us/library/gg492075.aspx
SET ARITHABORT (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms190306.aspx
SET IMPLICIT_TRANSACTIONS (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187807.aspx
SET TRANSACTION ISOLATION LEVEL (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms173763.aspx
SET XACT_ABORT (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188792.aspx
Showplan Logical and Physical Operators Reference http://msdn.microsoft.com/en-us/library/ms191158.aspx
sp_estimate_data_compression_savings (Transact-SQL) http://msdn.microsoft.com/en-us/library/cc280574.aspx
sp_sequence_get_range http://msdn.microsoft.com/en-us/library/ff878352.aspx
Specify Computed Columns in a Table http://technet.microsoft.com/en-us/library/ms188300.aspx
SQL Injection http://msdn.microsoft.com/en-us/library/ms161953%28SQL.105%29.aspx
SQL Server Encryption http://technet.microsoft.com/en-us/library/bb510663.aspx
String Functions (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms181984
sys.dm_tran_database_transactions http://msdn.microsoft.com/en-us/library/ms186957(v=sql.90).aspx
Table Hints (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187373.aspx
Table Hints (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187373.aspx
The Data Loading Performance Guide http://msdn.microsoft.com/en-us/library/dd425070.aspx
Troubleshooting Poor Query Performance: Cardinality Estimation http://technet.microsoft.com/en-us/library/ms181034.aspx
TRY_PARSE (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188792.aspx
Unicode Compression Implementation http://msdn.microsoft.com/en-us/library/ee240835.aspx
UNION (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms180026.aspx
UPDATE STATISTICS (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187348.aspx
Use AUTO Mode with FOR XML http://msdn.microsoft.com/en-us/library/ms188273.aspx
Use EXPLICIT Mode with FOR XML http://msdn.microsoft.com/en-us/library/ms189068.aspx
Using @@ERROR http://msdn.microsoft.com/en-us/library/ms190193.aspx
Using APPLY http://msdn.microsoft.com/en-us/library/ms175156.aspx
Using Partitioned Views http://msdn.microsoft.com/en-us/library/ms190019.aspx
WHERE (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms188047.aspx
Views http://msdn.microsoft.com/en-us/library/ms190174.aspx
Write-Ahead Transaction Log http://msdn.microsoft.com/en-us/library/ms186259%28SQL.105%29.aspx
XACT_STATE (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms189797.aspx
XQuery Functions against the xml Data Type http://msdn.microsoft.com/en-us/library/ms189254.aspx