powershell 发布SDL Web 8.5(Tridion)项并检查结果。这是这个旧脚本的8.5版本:https://gist.github.com/jhorsman/6b263962
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 发布SDL Web 8.5(Tridion)项并检查结果。这是这个旧脚本的8.5版本:https://gist.github.com/jhorsman/6b263962相关的知识,希望对你有一定的参考价值。
$ErrorActionPreference = "Stop"
$subject = "/webdav/400 Example Site/Home/000 Home.tpg"
#$subject = "/webdav/400 Example Site/Home/_Navigation.tpg"
#$subject = "/webdav/400 Example Site/Home"
# if you do not have the Tridion-CoreService module yet: get it from https://github.com/pkjaer/tridion-powershell-modules
Import-Module Tridion-CoreService -Verbose:$false
# Set up a Tridion Core Service client for the Content Manager server cms.server.com.
Set-TridionCoreServiceSettings -HostName "cms.server.com" -Version Web-8.5
# for debugging
$VerbosePreference = "continue"
$client = Get-TridionCoreServiceClient
# Set a publish instruction with resolve instruction and render instruction. These are all standard
# instructions, nothing special here but you can use this to create a special publinshing action.
$resolveInstruction = New-Object Tridion.ContentManager.CoreService.Client.ResolveInstructionData
$renderInstruction = New-Object Tridion.ContentManager.CoreService.Client.RenderInstructionData
$publishIntructionData = New-Object Tridion.ContentManager.CoreService.Client.PublishInstructionData
$publishIntructionData.RenderInstruction = $renderInstruction
$publishIntructionData.ResolveInstruction = $resolveInstruction
$readOptions = New-Object Tridion.ContentManager.CoreService.Client.ReadOptions
Write-Verbose "publishing..."
$publishTransaction = $client.Publish($subject, $publishIntructionData, "Staging",
[Tridion.ContentManager.CoreService.Client.PublishPriority]::Normal, $readOptions)
Write-Verbose "published items"
Write-Output ("publishing " + $subject + "...")
Write-Verbose "waiting for publishing to finish..."
$filter = New-Object Tridion.ContentManager.CoreService.Client.PublishTransactionsFilterData
while ($true) {
$publishTransactions = $client.GetSystemWideList($filter);
$publishTransaction = $publishTransactions.Where{$_.Id -eq $publishTransaction.Id}
Write-Verbose ("publish transaction " + $publishTransaction.Id + "; State: " + $publishTransaction.State)
if ($publishTransaction.State -eq "Success" -Or $publishTransaction.State -eq "Failed" -Or $publishTransaction.State -eq "Warning") {
break
}
Start-Sleep -Seconds 1
}
Write-Output ("published with state " + $publishTransaction.State)
以上是关于powershell 发布SDL Web 8.5(Tridion)项并检查结果。这是这个旧脚本的8.5版本:https://gist.github.com/jhorsman/6b263962的主要内容,如果未能解决你的问题,请参考以下文章