5

How can I publish a page by leveraging PowerShell, instead of building yet another C# console application?

This is a practical theoretical question, based on Timer Jobs in Tridion.

3
  • possible duplicate of How to Publish from PowerShell? Commented Jan 28, 2014 at 15:47
  • @SivaCharan: Similar title, different question. I do not think it is a duplicate.
    – Jan H
    Commented Jan 28, 2014 at 15:50
  • It's not a duplicate. I'm not sure if it offers much beyond "how can I publish using the core service", but closing it as a duplicate wouldn't be correct. Commented Feb 2, 2014 at 13:52

1 Answer 1

5

A few lines of PowerShell can do the trick and is a powerful toy for automated administrative tasks.

1: Install Tridion Powershell Modules. See the project on Google Code to download the module and these setup instructions.

2: Get the page URI and PublishTarget URI.

3: Run a script like this. This will get you a CoreService client (this is the part which uses the Tridion PowerShell Modules), create a PublishInstruction, and publish a page (tcm:69-6164-64) to a target(tcm:0-1-65537).

Set-TridionCoreServiceSettings cms.server.com 2013-SP1
$client = Get-TridionCoreServiceClient

$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

$client.Publish("tcm:69-6164-64", $publishIntructionData, "tcm:0-1-65537", 
    [Tridion.ContentManager.CoreService.Client.PublishPriority]::Normal, $readOptions)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.