Language: PowerShell
View on GitHub to download or comment.
See the Client API Examples Introduction for additional information and prerequisites.
This PowerShell script uses the adTempus API to retrieve a Credential Profile and set a new password for it.
Usage:
.\set-adtcredentialpassword -account userid -newpassword password
        param (
    [string]$server = ".",
    [Parameter(Mandatory)]
    [string]$account,
    [Parameter(Mandatory)]
    [string]$newPassword
 )
#see www.arcanadev.com/support/CodeSamples/4e230023ad6280ee9ebbfb90b9f2f8fb for more information
# Reference for adTempus 4
# add-type -path "c:\program files\arcana development\adtempus\4.0\ArcanaDevelopment.adTempus.Client.dll"
# For adTempus 5 use one of these instead:
# if running on an adTempus server:
add-type -path "c:\program files\arcana development\adtempus\instances\default\bin\ArcanaDevelopment.adTempus.Client.dll"
add-type -path "c:\program files\arcana development\adtempus\5.0\Console\ArcanaDevelopment.adTempus.Shared.dll"
add-type -path "c:\program files\arcana development\adtempus\5.0\Console\ArcanaDevelopment.adTempus.Resources.dll"
# if only the Console is installed:
# add-type -path "c:\program files\arcana development\adtempus\5.0\Console\ArcanaDevelopment.adTempus.Client.dll"
# add-type -path "c:\program files\arcana development\adtempus\5.0\Console\ArcanaDevelopment.adTempus.Shared.dll"
# add-type -path "c:\program files\arcana development\adtempus\5.0\Console\ArcanaDevelopment.adTempus.Resources.dll"
try{
    $adtempus=[ArcanaDevelopment.adTempus.Client.Scheduler]::Connect($server,[ArcanaDevelopment.adTempus.Shared.LoginAuthenticationType]::Windows,"","")
}
catch{
    $_
    exit 8
}
try{
    $context=$adtempus.NewDataContext()
    $profile=$context.GetCredentialProfile($account, $null, $null)
    if($profile -eq $null){
        Write-Output "Profile not found"
        exit 8
    }
    $profile.SetPassword($newPassword)
    $profile.Save()
    Write-Output "Password updated"
}
catch{
    $_
    exit 8
}
finally{
    $context.Dispose()
    $adTempus.Dispose()
}
        View on GitHub to comment.