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.
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.
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)