11

I came across the tridion-powershell-modules project. It offers some handy PowerShell commands which help setting up a CoreService connection and some examples like listing the publication.

What do I need to do to be able to use those commands in PowerShell

17

Install the module

  • Get the .psm1, .psd1 and DLL files from the project. You can also copy the CoreService DLL from the %TRIDION_HOME%bin\client\CoreService folder on your Content Manager
  • Create a directory C:\Users\username\Documents\WindowsPowerShell\Modules\CoreService C:\Users\username\Documents\WindowsPowerShell\Modules\Tridion-CoreService
  • Copy the .psm1, .psd1 and .dll files in that directory
  • Restart any open PowerShell consoles and the Modules are available
  • Run Import-Module CoreService Import-Module Tridion-CoreService
  • Run the Get-TridionCoreServiceInfo Get-TridionCoreServiceSettings to test if you can use the CoreService module. This will not yet contact the Core Service.

Test the connection to the Core Service

  • Set the Tridion Content Manager server hostname with Set-TridionCoreServiceHost cme.server.hostname Set-TridionCoreServiceSettings cme.server.hostname 2013-SP1 where "cme.server.hostname" is your server's hostname. The module will default to localhost.
  • See if you can access the Core Service by doing a simple operation: Get-TridionUser -Verbose. The "-Verbose" will output in verbose mode so you can see what is going on in more detail...
  • Now the connection works you can try more commands like Get-TridionPublications | Select-Object Id, Title to list the publication id and title of all publications.

MSDN explains the options we have to install the module.

EDIT: updated answer with steps to install and steps to test try the module and the connection to the Core Service

EDIT: added Import-Module CoreService to the instructions, the module will not work without that

EDIT: updated commands to match new version of the tridion-powershell-modules

  • Glad to see you figured it out. I shared the code, but not instructions on how to use it. I should add this to the project page! – Peter Kjaer Nov 20 '13 at 9:12
  • yes please add it together with a usage example. the code is pretty easy to read by the way it's just my lack knowledge on PowerShell. I had to change the event in the code to use it on Tridion 2013. – Jan H Nov 20 '13 at 10:33
  • 1
    As you know from our talk yesterday, I have since added support for the later versions of Tridion. I already had it locally, just forgot to update the repository (oops!). I'll add some setup and usage info to the project page. – Peter Kjaer Nov 21 '13 at 7:37
  • works great! i.e. Get-TridionPublications | Select-Object Id, Title – Jan H Nov 22 '13 at 13:39
  • 1
    Wish I could double up-vote both your question and your answer to this. – Glenn Stevens Nov 22 '13 at 17:12
1

The tridion-powershell-modules project moved to GitHub: https://github.com/pkjaer/tridion-powershell-modules

It now is a one-liner to install the module

 wget "https://raw.githubusercontent.com/pkjaer/tridion-powershell-modules/master/Installation/Install.ps1" | iex

Antother thing which changed is the prerequisites: the new version requires Powershell 3.0.

  • The installer File is missing - 404 – Chris Mills Nov 27 '15 at 9:40
  • It works for me -- perhaps it's a cache or DNS issue? – Peter Kjaer Nov 27 '15 at 9:43
1

For completeness, (but not a method officially supported by Peter Kjaer). If you are comfortable with getting things running your own way, you might find it interesting to pull directly from GIT. I have my WindowsPowerShell directory in a GIT repository anyway, and I've blogged here about how to manage the module as a GIT submodule.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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