Before you begin
- If you want to use the command-line examples in this guide:
- Install or update to the latest version of the gcloud command-line tool.
- Set a default region and zone.
- Create a Windows instance.
Generating a password
You can generate Windows passwords using either the
GCP Console or a gcloud command. Alternatively, you can
generate passwords programmatically
with API commands. If you forget your password, you can also use this procedure
to reset it.
Console
In the GCP Console:
- Go to the VM instances page.
- Click the Windows instance where you want to generate a new password.
- On the instance details page, click the Set Windows password button.
- 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.
- Click Set.
gcloud
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 [https://www.googleapis.com/compute/v1/projects/example-user/zones/us-central1-f/instances/windows-instance].
ip_address: 130.211.133.229
password: F0Lpj?5{*g.>5xT
username: [USERNAME]
By default, gcloud 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:
- Connect to your Windows instance using the generated password.
- After the desktop finishes loading, click the Start menu icon.
- Click Control Panel.
- Under the User Accounts icon, click either Change Account Type or Add or remove user accounts.
- Select the account that you want to modify.
- Click Change the password.
- Enter in your current password and your new password.
- Click Change password to save your changes.
- Test that your new password works by disconnecting and reconnecting to the instance using your new password.


