Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- .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()
- }
Add Comment
Please, Sign In to add comment