Archivio

Archive for the ‘SharePoint’ Category

Sharepoint – updated Tools

Common (legacy) Tools used for Paltform maintenance and governance:
https://nicolaxanth.wordpress.com/2011/07/22/sharepoint-blog-tools-utili-per-la-gestione-e-la-migrazione-della-farm/

Updated Tools (Sharepoint 2013):

ULS Viewer updated:
http://www.microsoft.com/en-us/download/confirmation.aspx?id=44020

 

Sharepoint – move subsite to a new site collection (and new database)

Sometimes we need to rearrange large size content database into smaller pieces to make each lower than 100 GB (Best Practice)

This is easy enough if we had organize the content in sitecollections, in this case we can move the sitecollection using the powershell command:

Move-SPSite <http://ServerName/Sites/SiteName> -DestinationDatabase <DestinationContentDb>

 

On the other hand the issue requires more effort if we must extract a subsite and create a dedicated Site Collection/DataBase.

Here are some steps and work to be done to achieve the goal:

 

STEP-1: Some assesment and planning occurs first:

-Identify  used Content Types

-Identify used Features

-Identify used Workflows

-(Identify Parent Site Template)

-(Identify Parent Site Language)

 

STEP-2: Create a site collection MySiteColl1 (with a  dedicated DataBase: WSS_Content_MySiteColl1)

 

STEP-3:

-Enable Features

-Enable WorkFlows

-Copy Content Types

This is quite easy using Gary Laponte tool: http://www.falchionconsulting.com/PowerShellViewer/Default.aspx?Version=SP2013&Cmdlet=Copy-SPContentType

 

Example:

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
$siteSRC="http://myintranet/"
$siteDST="http://myintranet/mysitecoll1/"
#
# My Content Types
#
$MyCtype = 'MY_CONTENT_TYPE1'
Copy-SPContentType -SourceContentType $MyCtype -SourceWeb $siteSRC -TargetWeb $siteDST
Write-host "$MyCtype Copied"
...

STEP-4:

(Backup the entire SiteCollection so we have a recovery point just in case of Rollback)

Export Site

STSADM (export/import)

Stsadm - o export -url http://source/mysite1 -includeusersecurity -versions 4 -filename \\backup\mysite1-Backup.bak

 

Powershell  (export/import)

Export-SPWeb http://srv1/mysite1 -includeusersecurity -includeversions All -path \\backup\mysite-Backup.bak

(then rename your Site so  your users are not able to use it anymore)

 

STEP-5:

Import Site

STSADM (export/import)

Stsadm -o import -url http://destination/mysitecoll1/mysite1 -filename \\backup\mysite1-Backup.bak -includeusersecurity

 

Powershell  (export/import)

Import-SPWeb http://destination/mysitecoll1/mysite1 -path \\backup\mysite1-Backup.bak -includeusersecurity

(then create a new Link to the new Site)

 

 

STEP-6:

Delete Old Site.

Pay attention: this operation is not simple as it seems to be if the old site is big enough (more than 20GB)

In my opinion, best way to do it is deleting the old site piece by piece (working on libraries)

Another tip is to turn off the Recycle Bin (just for the time we do this specific maintenance).

RecBin

Categorie:SharePoint Tag:

Sharepoint – Extract Farm Solutions

Powershell script to extract Farm Solutions (.wsp files)

#Add-PSSnapin Microsoft.Sharepoint.Powershell
#
$Folder = “C:\TEMP\mySolutions\”
Set-Location $Folder
#
write-host “download FARM Solutions”
$Farm = Get-SPFarm
foreach(SSol in Get-SPSolution) {
write-host “download Solution:” $Sol.name
$file = $Farm.Solutions.Item($Sol.name).SolutionFile
$file.SaveAs($Folder+$Sol.name)
}
Get-SPSolution > $Folder’ExtractSolution_out.txt’

 

Categorie:SharePoint

SP2010 – Powershell per inserimento Conten Type

#Comando per eseguire le istruzioni Sharepoint/Powershell (da eseguire una sola volta all'inizio)
#Add-PSSnapin microsoft.sharepoint.powershell

# PARAMETRI
#----------- 
#URL del sito 
$parUrl = "http://myServer:12345/"  
$parSite = get-spsite $parUrl

$parWeb = $parsite.openweb() 

# Nome Content Type 
$parctypeName = "Nome Content Type"  
# Gruppo: se non specificato, inserisce nel gruppo di DEFAULT (Custom Content Type), altrimenti specificare il Gruppo (esistente oppure un nuovo gruppo) 
$parCTGroup = "Nuovo Gruppo TEST" 

# Parent del Content Type (Document, Item,...) 
$parParent = "Item" 

# Descrizione del Content Type 
$parDescription = "Descrizione..." 

# ESECUZIONE 
#------------ 
$ctypeParent = $parWeb.availablecontenttypes[$parParent] 

$ctype = new-object Microsoft.SharePoint.SPContentType($ctypeParent, $parWeb.contenttypes, $parctypeName) 

$ctype.Description = $parDescription 
$ctype.Group = $parCTGroup 

# Aggiunge il Content Type 
$parWeb.contenttypes.add($ctype) 

# definisco i campi del Content Type che ho creato 
#$web.fields.add("Campo1", ([Type]"Microsoft.SharePoint.SPFieldType")::Text, $false) 
#$web.fields.add("Campo2", ([Type]"Microsoft.SharePoint.SPFieldType")::Text, $false)
  
# Creo le Site Column e definisco il gruppo (delle site column non del Content Type) in cui inserirle (Inserire il Gruppo esistente oppure il nuovo gruppo) 
$fieldXML1 = '<Field Type="Text" Name="Campo1" Description="Descrizione Campo 1" DisplayName="Campo1" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo1"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML1) 

$fieldXML2 = '<Field Type="Text" Name="Campo2" Description="Descrizione Campo 2" DisplayName="Campo2" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo2"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML2) 

# CHOICE 
$fieldXML3 = '<Field Name="Campo3" Type="Choice" DisplayName="Campo3" Format="RadioButtons" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" FillInChoice="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo3"><Default>Scelta1</Default><CHOICES><CHOICE>Scelta1</CHOICE><CHOICE>Scelta2</CHOICE></CHOICES></Field>'
 
$parWeb.Fields.AddFieldAsXml($fieldXML3) 

# MULTIPLE LINE OF TEXT 
$fieldXML4 = '<Field Type="Note" Name="Campo4" Description="Descrizione Campo 4" DisplayName="Campo4" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" NumLines="6" RichText="FALSE" Sortable="FALSE" StaticName="Campo4"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML4)  
# NUMBER 
$fieldXML5 = '<Field Type="Number" Name="Campo5" Description="Descrizione Campo 5" DisplayName="Campo5" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo5"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML5) 

#DATETIME 
$fieldXML6 = '<Field Type="DateTime" Name="Campo6" Description="Descrizione Campo 6" DisplayName="Campo6" Group="NuovoGruppoColumn" Hidden="FALSE" Required="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInListSettings="TRUE" ShowInNewForm="TRUE" StaticName="Campo6" Format="DateOnly"></Field>' 
$parWeb.Fields.AddFieldAsXml($fieldXML6)  

$field1 = $parWeb.fields.getfield("Campo1") 
$field2 = $parWeb.fields.getfield("Campo2") 
$field3 = $parWeb.fields.getfield("Campo3") 
$field4 = $parWeb.fields.getfield("Campo4") 
$field5 = $parWeb.fields.getfield("Campo5") 
$field6 = $parWeb.fields.getfield("Campo6") 

$fieldLink1 = new-object Microsoft.SharePoint.SPFieldLink($field1) 
$fieldLink2 = new-object Microsoft.SharePoint.SPFieldLink($field2) 
$fieldLink3 = new-object Microsoft.SharePoint.SPFieldLink($field3) 
$fieldLink4 = new-object Microsoft.SharePoint.SPFieldLink($field4) 
$fieldLink5 = new-object Microsoft.SharePoint.SPFieldLink($field5) 
$fieldLink6 = new-object Microsoft.SharePoint.SPFieldLink($field6) 

$ctype.fieldlinks.add($fieldLink1) 
$ctype.fieldlinks.add($fieldLink2) 
$ctype.fieldlinks.add($fieldLink3) 
$ctype.fieldlinks.add($fieldLink4) 
$ctype.fieldlinks.add($fieldLink5) 
$ctype.fieldlinks.add($fieldLink6)   
$ctype.Update() 

$parWeb.Dispose() 

$parSite.Dispose() 
Categorie:SharePoint

SP2010 – Overview RBS (Remote Blob Storage)

 Sharepoint 2010 e SQL Server

Schema Architettura



STEP Configurazione RBS

 Step SQL SERVER Sharepoint 2010 WFE NOTE
1 ENABLE AND CHANGE FILESTREAM SETTINGS A livello di istanza

 
2 PROVISION A BLOB STORE WITH THE FILESTREAM PROVIDER Per <ContentDbName>

Su disco del server DB

3 INSTALL RBS (on all WFE)

ENABLE AND TEST RBS (powershell)
Per <ContentDbName>
4 Migrate Existing Documents from the Database to the Remote Blob Store

(powershell)

Da DB


SP2010 – Check Sharepoint Farm: PowerShell instructions (.ps1)

15/02/2013 Commenti disabilitati

#Add-PSSnapin Microsoft.SharePoint.PowerShell

# Identify BUILD VERSION

get-spfarm | select BuildVersion

# Check SKU (Sharepoint Edition)

get-spfarm | select Products | ft -auto

# GUIDs delle SKU:

# —————-

# BEED1F75-C398-4447-AEF1-E66E1F0DF91E: SharePoint Foundation 2010

# 1328E89E-7EC8-4F7E-809E-7E945796E511: Search Server Express 2010

# B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0: SharePoint Server 2010 Standard Trial

# 3FDFBCC8-B3E4-4482-91FA-122C6432805C: SharePoint Server 2010 Standard

# 88BED06D-8C6B-4E62-AB01-546D6005FE97: SharePoint Server 2010 Enterprise Trial

# D5595F62-449B-4061-B0B2-0CBAD410BB51: SharePoint Server 2010 Enterprise

# BC4C1C97-9013-4033-A0DD-9DC9E6D6C887: Search Server 2010 Trial

# 08460AA2-A176-442C-BDCA-26928704D80B: Search Server 2010

# 84902853-59F6-4B20-BC7C-DE4F419FEFAD: Project Server 2010 Trial

# ED21638F-97FF-4A65-AD9B-6889B93065E2: Project Server 2010

# 926E4E17-087B-47D1-8BD7-91A394BC6196: Office Web Companions 2010

# Cehck Site Collections SIZE

Get-SPSite -Limit All | select url, @{label=”Size in KB”;Expression={$_.usage.storage}} | Format-Table -AutoSize | out-string -width 2048

# List All Farm Solutions

Get-SPSolution

Categorie:SharePoint Tag:,

SP2010 – Installazione e Rimozione Farm Solution

Installazione Farm Solution

L’installazione di una farm solution agisce su più livelli

  • Web Application BIN folder
  • Global Assembly Cache (GAC)
  • The Solution Hive

La solution una volta installata può richiedere l’abilitazione di Feature (l’ambito della Feature dipende dalla Solution e dalle sue caratteristiche by design, ovvero la dipendenza è legata all’ambito di azione: Web Application, Site Collection, WebSite )
Esempio Solution: Sogeti.SharePoint.WarmUp.wsp

(http://sharepointwarmup.codeplex.com/)

#POWERSHELL:

#———–

# Carica Powershell snap-in di Sharepoint

#add-pssnapin microsoft.sharepoint.powershell

# Install Solution

#—————–

Add-SPSolution “C:\TEMP\TOOLS\SP2010-WarmUp_CODEPLEX\Sogeti.SharePoint.WarmUp.wsp”

Install-SPSolution -Identity Sogeti.SharePoint.WarmUp.wsp -GACDeployment

Verifica della GAC using Explorer: %windir%\assembly (C:\windows\assembly)


Esempio Abilitazione Feature: Sogeti.SharePoint.WarmUp.wsp (ambito Web Application)

CENTRAL ADMIN

Application Management > (scelta della Web Application) > Manage Features



Rimozione (Uninstall) di una Farm Solution

ATTENZIONE: La Best Practice per la Rimozione delle Features prevede di fare esattamente gli stessi passi dell’installazione partendo dalla fine:

  • Disattivazione Features Attivate (per evitare di creare dei riferimenti “orfani”)
  • Uninstall della solution (rimuove l’assembly)
  • Rimozione del pacchetto

#POWERSHELL:

#———–

# Carica Powershell snap-in di Sharepoint

#add-pssnapin microsoft.sharepoint.powershell

# UnInstall Solution

#——————-

Uninstall-SPSolution -Identity Sogeti.SharePoint.WarmUp.wsp

Remove-SPSolution -Identity Sogeti.SharePoint.WarmUp.wsp

Categorie:SharePoint Tag:

SP2010 – Service Applications – Compare Editions

SHAREPOINT 2010

Service Applications – Compare Editions

SERVICE APPLICATION FOUNDATION SERVER STANDARD SERVER ENTERPRISE
Access Service



Y

Application Discovery and Load Balancer Service Application

Y

Y

Y

Application Registry Service


Y

Y

Business Data Connectivity

Y

Y

Y

Excel Services



Y

Managed Metadata Service


Y

Y

PerformancePoint Service Application



Y

Search Service Application


Y

Y

Secure Store Service


Y

Y

Security Token Service Application

Y

Y

Y

State Service


Y

Y

Usage and Health Data collection

Y

Y

Y

User Profi le Service Application


Y

Y

Visio Graphics Service



Y

Web Analytics Service Application



Y

Word Automation Services



Y

Lotus Notes Connector Service



Y


Categorie:SharePoint Tag:

Display and check GAC (Global Assembly Cache) – gacutil, explorer, cmdshell

I found this information useful to check install/uninstall procedure for Sharepoint Farm Solutions.

I wanted to check what happens under the hood, and also be sure my procedures did a clean job.
(Example: Install-SPSolution -Identity <mySolution>.wsp -GACDeployment)

Display GAC using Explorer: %windir%\assembly

Example: C:\windows\assembly



Display GAC using Command Shell

Example:

C:\Windows\assembly>dir /s |findstr <myAssemblyName>

With command shell you can retrieve more and best details (information includes structure and sub directories)

C:\Windows\assembly>dir
Directory of C:\Windows\assembly
28/07/2011 17:17 <DIR> GAC
06/04/2012 16:53 <DIR> GAC_32
12/07/2012 09:24 <DIR> GAC_64

14/08/2012 11:56 <DIR> GAC_MSIL

14/06/2012 13:19 <DIR> NativeImages_v2.0.50727_32

12/07/2012 09:27 <DIR> NativeImages_v2.0.50727_64

14/06/2012 13:31 <DIR> NativeImages_v4.0.30319_32

14/06/2012 10:57 <DIR> NativeImages_v4.0.30319_64

14/08/2012 15:15 <DIR> temp

14/08/2012 11:56 <DIR> tmp

0 File(s) 0 bytes

10 Dir(s) 4.207.726.592 bytes free


Global Assembly Cache Tool (Gacutil.exe)
(http://msdn.microsoft.com/en-us/library/ex0ss12c(v=vs.90).aspx)

Example:
Gacutil -l | findstr <myAssemblyName>

Where is gacutil.exe:

Directory of C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
18/03/2010 20:51 103.248 gacutil.exe
31/08/2009 05:09 181 gacutil.exe.config
2 File(s) 103.429 bytes
0 Dir(s) 4.212.731.904 bytes free


Sharepoint – STSADM and PowerShell commands

STSADM Reference (SP 2007):
http://technet.microsoft.com/en-us/library/cc261956(office.12).aspx

PowerShell for Sharepoint Reference (SP 2010):
Windows PowerShell for SharePoint Server 2010

http://technet.microsoft.com/en-us/library/ee662539.aspx

Index of SharePoint Server 2010 Windows PowerShell cmdlets
http://technet.microsoft.com/en-us/library/ff678226.aspx


Creating a sharepoint PowerShell batch file:

Filename: MyBatch.ps1
First row: Add-PSSnapin Microsoft.SharePoint.PowerShell
Next rows: powershell commands

STSADM to Windows PowerShell mapping (SharePoint Server 2010)
http://technet.microsoft.com/en-us/library/ff621084.aspx

PowerShell console and STSADM changes (SP 2007 vs SP 2010):
Source:
http://blog.falchionconsulting.com/index.php/2009/10/sharepoint-2010-stsadm-and-powershell/

“…

This new console window is actually just a PowerShell console which pre-loads the SharePoint PowerShell Snap-in.  You can see that by looking at the target for the shortcut:

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -NoExit  ” & ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ‘ ”

…”

 

NOTA: Molto utile per il debug la console ISE
Per attivarla eseguire da PowerShell :

Import-Module ServerManager
Add-WindowsFeature PowerShell-ISE

RISULTATO:

Nuovo eseguibile:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe

Nuova voce in: Programmi > Accessori > Windows Powershell > Windows Powershell ISE

Categorie:SharePoint Tag: