Created
January 28, 2018 12:02
-
-
Save JacquesKors/179024b5e88a2493b990b5191905f2c0 to your computer and use it in GitHub Desktop.
This file contains 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
<# | |
.Description | |
sets relevant tridion core service client settings | |
Write password by running | |
Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File $CredentialFile | |
#> | |
[CmdletBinding()] | |
Param ( | |
[Parameter(Mandatory=$false)] | |
[String]$HostName='CMS.SAMPLE.DOMAIN', | |
[Parameter(Mandatory=$false)] | |
[String]$User = 'DOMAIN\USER', | |
[Parameter(Mandatory=$false)] | |
[String]$CredentialFile='C:\Some\Path\To\Credentials\samplePassword.txt' | |
) | |
Begin { | |
Import-Module Tridion-CoreService -Verbose:$false | |
} | |
Process { | |
# Write password by running | |
# read-host -assecurestring | convertfrom-securestring | out-file $credentialFile | |
$credentialPassword = cat $credentialFile | convertto-securestring | |
$credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $user,$credentialPassword | |
Set-TridionCoreServiceSettings -HostName $HostName -ConnectionType Basic-SSL -CredentialType Basic -Credential $credential | |
$client = Get-TridionCoreServiceClient | |
$client.GetCurrentUser() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment