-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deployment scripts - Feture, Site Collection and List Items
- Loading branch information
Showing
7 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
############################################################################################################################################ | ||
# Script para la activación de una Feature | ||
# Parámetros necesarios: | ||
# - Identidad de la Feature | ||
# - URL del sitio | ||
############################################################################################################################################ | ||
|
||
|
||
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) | ||
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell } | ||
|
||
#Hacemos un buen uso de PowerShell para no penalizar el rendimiento | ||
$host.Runspace.ThreadOptions = "ReuseThread" | ||
|
||
#Definición de la función que obtiene el tamaño de las BD's de contenidos | ||
function Activate-Feature | ||
{ | ||
param($sIdentity,$sWebUrl) | ||
try | ||
{ | ||
Enable-SPFeature -identity $sIdentity -URL $sWebUrl | ||
} | ||
catch [System.Exception] | ||
{ | ||
write-host -f red $_.Exception.ToString() | ||
} | ||
} | ||
|
||
Start-SPAssignment –Global | ||
$sWebUrl="http://sf1" | ||
|
||
$sIdentity="c3e7d105-d10b-4b81-a3f6-b1ea1b8974c0" | ||
Activate-Feature -sIdentity $sIdentity -sWebUrl $sWebUrl | ||
|
||
$sIdentity="b747d2ea-19de-41e3-b165-1b4772c85d32" | ||
Activate-Feature -sIdentity $sIdentity -sWebUrl $sWebUrl | ||
|
||
Stop-SPAssignment –Global | ||
Remove-PsSnapin Microsoft.SharePoint.PowerShell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
############################################################################################################################################ | ||
# Script para creación de elementos de una lista desde un CSV | ||
# Parámetros necesarios: | ||
# - URL del sitio | ||
# - Nombre de la lista | ||
# - Ruta al fichero CSV | ||
############################################################################################################################################ | ||
|
||
|
||
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) | ||
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell } | ||
|
||
#Hacemos un buen uso de PowerShell para no penalizar el rendimiento | ||
$host.Runspace.ThreadOptions = "ReuseThread" | ||
|
||
#Definición de la función que lee el CSV y lo carga en la lista | ||
function Add-CsvDataToList() | ||
{ | ||
param($sweb,$slistName,$scsvPath) | ||
|
||
try | ||
{ | ||
$web = Get-SPWeb -Identity $sweb | ||
$list = $web.Lists.get_Item($slistName) | ||
Import-Csv $scsvPath | ForEach-Object { | ||
$csvRow = $_ | ||
$newItem = $list.Items.Add() | ||
Get-Member -InputObject $csvRow -MemberType NoteProperty | ForEach-Object { | ||
$property = $_.Name | ||
|
||
if ($_.Name -eq "ENMARCHAReceiver") | ||
{ | ||
$user = Get-SPUser -Identity $csvRow.$property -web $sweb | ||
$newItem.set_Item($property, $user) | ||
} | ||
Elseif ($_.Name -eq "ENMARCHASender") | ||
{ | ||
$user = Get-SPUser -Identity $csvRow.$property -web $sweb | ||
$newItem.set_Item($property, $user) | ||
} | ||
Elseif ($_.Name -eq "ENMARCHAUser") | ||
{ | ||
$user = Get-SPUser -Identity $csvRow.$property -web $sweb | ||
$newItem.set_Item($property, $user) | ||
} | ||
Else | ||
{ | ||
$newItem.set_Item($property, $csvRow.$property) | ||
} | ||
} | ||
$newItem.Update() | ||
} | ||
} | ||
catch [System.Exception] | ||
{ | ||
write-host -f red $_.Exception.ToString() | ||
} | ||
} | ||
|
||
|
||
Start-SPAssignment –Global | ||
|
||
$sWebUrl="http://sf1" | ||
$sListName="Notifications" | ||
$sCSVPath="c:\deploy\notifications.csv" | ||
|
||
Add-CsvDataToList -sweb $sWebUrl -slistName $sListName -scsvPath $sCSVPath | ||
|
||
$sListName="Favorites" | ||
$sCSVPath="c:\deploy\favorites.csv" | ||
|
||
Add-CsvDataToList -sweb $sWebUrl -slistName $sListName -scsvPath $sCSVPath | ||
|
||
Stop-SPAssignment –Global | ||
Remove-PsSnapin Microsoft.SharePoint.PowerShell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
############################################################################################################################################ | ||
# Script para el borrado/creación de un Site Collection | ||
# Parámetros necesarios: | ||
# - URL del sitio | ||
############################################################################################################################################ | ||
|
||
|
||
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) | ||
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell } | ||
|
||
#Hacemos un buen uso de PowerShell para no penalizar el rendimiento | ||
$host.Runspace.ThreadOptions = "ReuseThread" | ||
|
||
function Create-Site | ||
{ | ||
param($sWebUrl) | ||
try | ||
{ | ||
New-SPSite -url $sWebUrl -template STS#0 -OwnerAlias “pharus\alberto.diaz“ -Name “Vitrall” | ||
} | ||
catch [System.Exception] | ||
{ | ||
write-host -f red $_.Exception.ToString() | ||
} | ||
} | ||
|
||
function Delete-Site | ||
{ | ||
param($sWebUrl) | ||
try | ||
{ | ||
Remove-SPSite -Identity $sWebUrl -Confirm:$False | ||
} | ||
catch [System.Exception] | ||
{ | ||
write-host -f red $_.Exception.ToString() | ||
} | ||
} | ||
|
||
|
||
Start-SPAssignment –Global | ||
|
||
$sWebUrl="http://sf1" | ||
|
||
Delete-Site -sWebUrl $sWebUrl | ||
|
||
Create-Site -sWebUrl $sWebUrl | ||
|
||
Stop-SPAssignment –Global | ||
Remove-PsSnapin Microsoft.SharePoint.PowerShell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ENMARCHAProject,ENMARCHAProjectId,Title,ENMARCHAType,ENMARCHAUser | ||
Project 1,1,Favorite 1,Search,Pharus\alberto.diaz | ||
Project 2,2,Favorite 2,Search,Pharus\alberto.diaz | ||
Project 3,3,Favorite 3,Search,Pharus\alberto.diaz | ||
Project 3,3,Favorite 4,Search,Pharus\alberto.diaz | ||
Project 3,3,Favorite 5,Search,Pharus\alberto.diaz | ||
Project 3,3,Favorite 6,Search,Pharus\alberto.diaz | ||
Project 4,4,Favorite 7,Production,Pharus\alberto.diaz | ||
Project 5,5,Favorite 8,Production,Pharus\alberto.diaz | ||
Project 6,6,Favorite 9,Production,Pharus\alberto.diaz | ||
Project 6,6,Favorite 10,Production,Pharus\alberto.diaz | ||
Project 6,6,Favorite 11,Production,Pharus\alberto.diaz | ||
Project 6,6,Favorite 12,Production,Pharus\alberto.diaz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ENMARCHAContent,ENMARCHAProject,ENMARCHAProjectId,ENMARCHAReceiver,ENMARCHASender,ENMARCHAStatus,Title | ||
Content 1,Project 1,1,pharus\alberto.diaz,pharus\alberto.diaz,Search,Search 1 | ||
Content 2,Project 1,1,pharus\alberto.diaz,pharus\alberto.diaz,Search,Search 2 | ||
Content 3,Project 1,1,pharus\alberto.diaz,pharus\alberto.diaz,Search,Search 3 | ||
Content 4,Project 4,4,pharus\alberto.diaz,pharus\alberto.diaz,Search,Search 4 | ||
Content 5,Project 5,5,pharus\alberto.diaz,pharus\alberto.diaz,Search,Search 5 | ||
Content 6,Project 5,5,pharus\alberto.diaz,pharus\alberto.diaz,Search,Search 6 | ||
Content 7,Project 7,7,pharus\alberto.diaz,pharus\alberto.diaz,Search,Production 7 | ||
Content 8,Project 8,8,pharus\alberto.diaz,pharus\alberto.diaz,Search,Production 8 | ||
Content 9,Project 8,8,pharus\alberto.diaz,pharus\alberto.diaz,Search,Production 9 | ||
Content 10,Project 10,10,pharus\alberto.diaz,pharus\alberto.diaz,Search,Production 10 | ||
Content 11,Project 11,11,pharus\alberto.diaz,pharus\alberto.diaz,Search,Production 11 | ||
Content 12,Project 12,12,pharus\alberto.diaz,pharus\alberto.diaz,Search,Production 12 | ||
Content 13,Project 13,13,pharus\alberto.diaz,pharus\alberto.diaz,Search,Production 13 | ||
Content 14,Project 14,14,pharus\alberto.diaz,pharus\alberto.diaz,Search,Production 14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.