December 12, 2017

Introduction to Tridion Powershell

What is PowerShell:
Windows PowerShell is a Windows command-line shell designed especially for system administrators. Windows PowerShell includes an interactive prompt and a scripting environment that can be used independently or in combination.
Windows PowerShell is built on top of the .NET Framework common language runtime (CLR) and the .NET Framework, and accepts and returns .NET Framework objects. Its also extensible.

Introduction to Tridion Powershell:


Peter Kjaer has developed Tridion Powershell Module  which contains cmdlets that allow you to talk to the Tridion Content Manager using the Core Service. This is very powerful and fast way to access Tridion system without opening CME. It Currently supported Tridion versions: 2011 SP1, 2013 GA, 2013 SP1 and Web 8.

Setting up Tridion Powershell:

Open Powershell windows as administrator. 
iwr "https://raw.githubusercontent.com/pkjaer/tridion-powershell-modules/master/CoreService/Installation/Install.ps1" | iex











Tridion Powershell module will be installed with above success message.

Verify Settings:
Run a command to test the environment. if there are issues in settings you may can following error



Get-TridionCoreServiceSettings will give you current settings its using. 
but ensure these settings are as per your environment

In my case, Coreservice was running at another port, so commands were failing. so you might have to update the setting as per need. 

Update Settings:

PS C:\Windows\system32> help set-TridionCoreServiceSettings

NAME
    Set-TridionCoreServiceSettings

SYNOPSIS
    Changes the settings used to connect to the Core Service.
when 
SYNTAX
    Set-TridionCoreServiceSettings [[-HostName] <String>] [[-Version] <String>] [[-Credential] <PSCredential>]
    [[-ConnectionType] <String>] [[-ConnectionSendTimeout] <String>] [-Persist] [<CommonParameters>]

Following command changes the hostName on my environment. You can update as per your enviornnment.

Set-TridionCoreServiceSettings -HostName localhost:91

after the setting are done, retry following command

Get-TridionPublications to get list of publications in the system.

No comments: