jhorsman
11/3/2016 - 8:15 AM

Test the tridion-powershell-modules

Test the tridion-powershell-modules

# This test can be run straigt from the tridion-powershell-modules repository folder
# Put this script in tridion-powershell-modules\CoreService\Tests

# Install the module
& (Join-Path -Path (Split-Path -Parent $MyInvocation.MyCommand.Path) -ChildPath "..\Installation\Install-Local.ps1")

# Stop on any errors
$ErrorActionPreference = "Stop";

# Optionally set the CoreService version and credentials
Set-TridionCoreServiceSettings -Version 2013-SP1
Set-TridionCoreServiceSettings -UserName "optional-domain\user" -Password "password"

# Do some suff with the Core Service, under the hood this will call Get-TridionCoreServiceClient
$user = Get-TridionUser -Verbose
Write-Host -ForegroundColor Yellow ("The current user is {0}" -f $user.Title)

$publications = Get-TridionPublications -Verbose
Write-Host -ForegroundColor Yellow ("There are {0} publications" -f $publications.Count)

Write-Host -ForegroundColor Green "Test passed"