Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save suryagahlot/8d1125d171015a64602883b76d3c0771 to your computer and use it in GitHub Desktop.
Save suryagahlot/8d1125d171015a64602883b76d3c0771 to your computer and use it in GitHub Desktop.
Simple example to installing a module package on a remote Sitecore instance. The package already exists on the server.
Import-Module -Name SPE -Force
$packageName = "$($SitecorePackageFolder)\[PACKAGE].zip"
$session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri "http://remotesitecore"
Test-RemoteConnection -Session $session -Quiet
$jobId = Invoke-RemoteScript -Session $session -ScriptBlock {
[Sitecore.Configuration.Settings+Indexing]::Enabled = $false
Get-SearchIndex | ForEach-Object { Stop-SearchIndex -Name $_.Name }
Import-Package -Path "$($SitecorePackageFolder)\$($using:packageName)" -InstallMode Merge -MergeMode Merge
[Sitecore.Configuration.Settings+Indexing]::Enabled = $true
} -AsJob
Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 5 -Verbose
Stop-ScriptSession -Session $session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment