Last active
December 29, 2015 10:39
-
-
Save jhorsman/7658365 to your computer and use it in GitHub Desktop.
Install the Tridion CoreService module. As documented in http://tridion.stackexchange.com/q/3641/88. This script is not stable at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$powershellModulePath = $env:UserProfile + "\Documents\WindowsPowerShell\Modules\Tridion-CoreService" | |
#todo test if path is in $env:PSModulePath http://msdn.microsoft.com/en-us/library/dd878350%28v=vs.85%29.aspx | |
$powershellClientPath = $powershellModulePath + "\Clients" | |
Write-Debug ("PowerShell module path: {0}" -f $powershellModulePath) | |
if(!(Test-Path $powershellModulePath)) | |
{ | |
$newModuleFolder = New-Item -path $powershellModulePath -type directory | |
Write-Debug ("Created new module directory {0}" -f $newModuleFolder.FullName) | |
} | |
if(!(Test-Path $powershellClientPath)) | |
{ | |
$newClientFolder = New-Item -path $powershellClientPath -type directory | |
Write-Debug ("Created new client directory {0}" -f $newClientFolder.FullName) | |
} | |
if(Get-Module Tridion-CoreService) | |
{ | |
Write-Debug "Module Tridion-CoreService already exists" | |
Remove-Module Tridion-CoreService | |
Write-Debug "Removed module Tridion-CoreService" | |
} | |
Copy-Item *.psm1 $powershellModulePath | |
Copy-Item *.psd1 $powershellModulePath | |
# @todo prevent copy errors | |
# how to we figure out if this is writable? | |
# can we unload the DLLs so that we can deploy them? | |
Copy-Item "Clients\*.dll" $powershellClientPath #disable this line and copy manually if DLLs are already exist and in use | |
Write-Debug ("Copied module files from {0} to {1}" -f ((Get-Item ".\").FullName), ((Get-Item $powershellModulePath).FullName)) | |
Import-Module Tridion-CoreService | |
Write-Host ("Installed Tridion-CoreService module in {0}" -f (Get-Item $powershellModulePath).FullName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment