-
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.
Added two SharePoint WarmUp Scripts to the Utils folder
- Loading branch information
1 parent
a713864
commit 6d34423
Showing
2 changed files
with
87 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,50 @@ | ||
############################################################################################################################################ | ||
# Script that allows to Warm Up all the sites in a SharePoint Farm. | ||
# Required Parameters: None | ||
############################################################################################################################################ | ||
|
||
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) | ||
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell } | ||
|
||
$host.Runspace.ThreadOptions = "ReuseThread" | ||
|
||
Start-SPAssignment –Global | ||
|
||
#Definición de la función que obtiene el tamaño de las BD's de contenidos | ||
function Do-WarmUp | ||
{ | ||
try | ||
{ | ||
|
||
"Creating an Internet Explorer object for navigation." | ||
$ie = New-Object -ComObject InternetExplorer.Application | ||
|
||
Write-Host "Enumerate the SharePoint sites." -ForegroundColor Blue | ||
$spWebs = Get-SPWebApplication -IncludeCentralAdministration | Get-SPSite | Get-SPWeb -Limit All | ||
|
||
"Navigating to all $($spWebs.Count) sites." | ||
foreach ($spWeb in $spWebs) | ||
{ | ||
"Initializing $($spWeb.URL)" | ||
$ie.Navigate($spWeb.URL) | ||
while ($ie.Busy) | ||
{ | ||
Start-Sleep -Seconds 1 | ||
} | ||
Write-Host "SharePoint Site $($ie.Document.title) has been initialized" -ForegroundColor Blue | ||
} | ||
$ie.Quit() | ||
Write-Host "SharePoint Initialization Processs Completed succesfully!" -ForegroundColor Blue | ||
} | ||
catch | ||
{ | ||
Write-Host -Object ("Status: " + $Error[0].Exception.Message) -ForegroundColor Red | ||
} | ||
|
||
} | ||
|
||
Start-SPAssignment –Global | ||
Do-WarmUp | ||
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,37 @@ | ||
############################################################################################################################################ | ||
# Script that allows to Warm Up all the sites in a SharePoint Farm. | ||
# Required Parameters: None | ||
############################################################################################################################################ | ||
|
||
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) | ||
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell } | ||
|
||
$host.Runspace.ThreadOptions = "ReuseThread" | ||
|
||
Start-SPAssignment –Global | ||
|
||
#Definición de la función que obtiene el tamaño de las BD's de contenidos | ||
function Do-WarmUp | ||
{ | ||
try | ||
{ | ||
Write-Host "SharePoint Initialization Processs Completed succesfully!" -ForegroundColor Blue | ||
$spWebApps = Get-SPWebApplication -IncludeCentralAdministration | ||
foreach ($spWebApp in $spWebApps) | ||
{ | ||
Write-Host "Initializing $($spWebApp.URL)" | ||
Invoke-WebRequest $spWebApp.URL -UseDefaultCredentials -UseBasicParsing | ||
} | ||
Write-Host "SharePoint Initialization Processs Completed succesfully!" -ForegroundColor Blue | ||
} | ||
catch | ||
{ | ||
Write-Host -Object ("Status: " + $Error[0].Exception.Message) -ForegroundColor Red | ||
} | ||
} | ||
|
||
Start-SPAssignment –Global | ||
Do-WarmUp | ||
Stop-SPAssignment –Global | ||
|
||
Remove-PsSnapin Microsoft.SharePoint.PowerShell |