Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Adapted the functions written by Nick Wesselman to work directly in SPE.
Copied from Nick Wesselman's video
function Start-Publish {
[string]$Source = "master",
[string]$Target = "web"
$sourceDb = [Sitecore.Data.Database]::GetDatabase($Source)
$targetDb = [Sitecore.Data.Database]::GetDatabase($Target)
$languages = [Sitecore.Globalization.Language]::GetLanguages($sourceDb)
$handle = [Sitecore.Publishing.PublishManager]::PublishSmart($sourceDb, @($targetDb), $languages)
function Check-PublishStatus {
$handle = [Sitecore.Handle]::Parse($HandleName)
$handle = Start-Publish
$status = Check-PublishStatus -HandleName $handle
$processed = -1
while(-not $status.IsDone) {
if($status.Processed -ne $processed) {
$processed = $status.Processed
Write-Host "Publishing: $($processed) items"
Start-Sleep -Seconds 1
$status = Check-PublishStatus -HandleName $handle
Write-Host "Publishing: done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment