Creating Passwords for Windows Instances

Windows Server instances use password authentication instead of SSH authentication. To prevent unauthorized access to new Windows instances, Compute Engine requires that you generate a new Windows password for that instance before you connect to it. If you forget your password, you can generate a new one using this same process.

Before you begin

Generating a password

You can generate Windows passwords using either the Google Cloud Console or the gcloud command-line tool. Alternatively, you can generate passwords programmatically with API commands. If you forget your password, you can also use this procedure to reset it.


In the Cloud Console:

  1. Go to the VM instances page.

    VM instances page

  2. Click the Windows instance where you want to generate a new password.
  3. On the instance details page, click the Set Windows password button.
  4. The username field specifies which Windows user receives the new generated password. If you want to create a new user, specify a new username in this field and Compute Engine will add that user with a new password.
  5. Click Set.


Using the gcloud command-line tool, run the reset-windows-password command to generate a username and password:

gcloud compute reset-windows-password windows-instance
Resetting and retrieving password for example-user on windows-instance
Updated [].
password:   F0Lpj?5{*g.>5xT
username:   [USERNAME]

By default, the gcloud tool generates a new password for the user who authenticated to gcloud. You can generate a password for another user by including the --user flag in the command. If the username does not exist, Compute Engine generates a new username and password for the instance with that username.

Changing a password

Compute Engine generates a random password, but you should change the password to a custom password that is meaningful to you. To set a custom password:

  1. Connect to your Windows instance using the generated password.
  2. After the desktop finishes loading, click the Start menu icon.
  3. Click Control Panel.
  4. Under the User Accounts icon, click either Change Account Type or Add or remove user accounts.
  5. Select the account that you want to modify.
  6. Click Change the password.
  7. Enter in your current password and your new password.
  8. Click Change password to save your changes.
  9. Test that your new password works by disconnecting and reconnecting to the instance using your new password.

What's next