Search code examples
powershellsecret-server

Execute PowerShell script on remote server after Thycotic Secret Server password change


We're running the Thycotic Secret Server platform and attempting to onboard a secret associated with a Windows Service account. When Secret Server updates the password, I want a PowerShell to run on a remote server (i.e. the Windows Service host). From what I can tell, it appears that the PowerShell script is only running on the Secret Server, no matter what I put in the "Machine Name" field. See below:

enter image description here

I know this is the case, because within the script I am trying to access local files on remote_server_name.my.domain, but getting "File Does not Exist" errors. E.g. c:\Program Files\Some_Directory\FileName.txt. The only way I can access the file is by using a full FQDN path, i.e. \\remote_server_name.my.domain\c$\Program Files\Some_Directory\FileName.txt.

Below is the PowerShell script I am trying to get Secret Server to run on remote_server_name.my.domain run:

$appset = "c:\Program Files\Some_Directory\FileName.txt"
$a = Get-Content $appset | ConvertFrom-Json;

$a.'example'.node.password = $Args[0];

$a | ConvertTo-Json -Depth 100 | Set-Content $appset;
Restart-Service -Name "service_name"

What am I doing wrong here?


Solution

  • Thanks for your response @Cpt.Whale. Within the documentation you linked is an example of rotating the password of an AD user used to run a SQL Server instance. In the example, PowerShell Remote Commands are being used. I will assume (and admittedly, it makes sense that) this is what Thycotic wants you to do:

    enter image description here