Forked from michaellwest/SPERemoting-SimpleRemoteInstall.ps1
Created
September 7, 2019 22:31
-
-
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.
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
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