Skip to main content

Install the Password Rotation Script on a Windows Server

Password rotation changes the password of an account on a Windows server and stores the new password in the Privileged Credential in JumpCloud PAM. The change is done by a PowerShell script that you install on the server. Users never need to know the password.

This article explains how to download the script, copy it to the Windows server, register it with the Privileged Credential and run it. To enable password rotation on the credential, see Enable Password Rotation for a Privileged Credential.

Important

The password changes only when the script runs. Run the script manually, or schedule it on the server to rotate the password periodically.

Prerequisites

  • Password rotation is enabled on the Privileged Credential, and the Windows server is selected on it.
  • You have local Administrator access to the Windows server.
  • The Windows server uses TLS 1.2 or 1.3. Password rotation does not work on older versions.
  • The Windows server can reach the PAM API on port 443.
  • For an Active Directory user, the account that runs the script has permission to reset passwords and a higher group permission level than the account being rotated.

Download the Script and Generate the Key​

  1. In the JumpCloud Admin Portal, go to Access > PAM > Privileged Resources > Privileged Credentials.
  2. Find the credential and, in the Actions column, open the three-dot menu.
  3. Select Password Rotation.
  4. In the Install Password Rotation window, click Download Windows script. The script is saved on your computer.
  5. Click Generate key and copy the authentication key. The script asks for it the first time it runs.

Install Password Rotation window with Download Windows script and Generate key

warning

Keep the authentication key secure. It is needed only during the initial setup. Each credential has its own script and its own key.

Copy the Script to the Windows Server​

The script must run on the server where the password is rotated. Copy the file you downloaded to that server. If you access the server through PAM, you can use file transfer to upload the script to the server. For the steps, see Transfer Files in PAM Sessions.

If you do not access the server through PAM, copy the script with the method you normally use.

After the transfer, the file is available on the server. For example, open File Explorer, go to This PC and open the folder where you saved the script.

Run the Script​

  1. On the Windows server, open PowerShell as an administrator. For example, search for Windows PowerShell and select Run as administrator.
  2. Go to the folder where the script is. For example, if the script is on the Desktop:
cd $HOME\Desktop
  1. Run the script:
.\PAM_PasswordRotationInstaller.ps1

If Windows blocks the script with the error is not digitally signed, allow it in the current PowerShell window and run the script again:

PowerShell digitally signed error for the password rotation script

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Unblock-File .\PAM_PasswordRotationInstaller.ps1
.\PAM_PasswordRotationInstaller.ps1

Set-ExecutionPolicy applies only to the current PowerShell window.

  1. When the script asks for the user type, enter 1 for a Local User or 2 for an Active Directory User of the same domain as the server. The steps are the same for both.
  2. Paste the authentication key you copied from the Install Password Rotation window and press Enter.

Password rotation script prompting for authentication key on Windows

This first run only registers the script with the Privileged Credential. The password has not changed yet.

Rotate the Password​

Run the script again. This time it generates a new password, changes it on the server and stores it in the Privileged Credential.

.\PAM_PasswordRotationInstaller.ps1

Successful password rotation output on Windows

Check the Rotation​

  1. In the credential’s Actions column, open the three-dot menu and select History.
  2. Confirm that the list has a new entry with the date of the rotation. To see a password, click the eye icon.

Credential History showing a password rotation entry

Rotate the Password on a Schedule​

PAM does not schedule the script. To rotate the password periodically, schedule the script on the server with a tool of your choice, such as Windows Task Scheduler. The schedule and its frequency are defined by you.

warning

After 3 consecutive authentication failures, the script stops working. To use it again, repeat the process in this article, with a new key.

Was this information helpful?