PowerShell Example via SSH
Rotating a Windows Service Credential using SSH
Last updated
Was this helpful?
Rotating a Windows Service Credential using SSH
Last updated
Was this helpful?
This example performs service credential update and restart of a service using the SSH protocol. The recommended method is using the WinRM script.
To run this script, SSH public key authentication must be set up and enabled between the gateway server and the target server.
In the below example, you will hard code three values:
The name of the service for which you wish to rotate the credential.
The DNS resolvable name of the server the service is running on.
The username of the SSH user
Native SSH remoting is still not fully implemented into PowerShell and is only reliably possible in PowerShell 7. The gateway defaults to Windows PowerShell (v5) when running a .ps1
script. However, when attaching the script, you can also specify an alternative script command and point to the path of your PowerShell 7 executable.