Generating credentials for Windows VMs


Windows virtual machine (VM) instances authenticate by using a username and a password instead of by using SSH. You must generate new credentials before connecting to the VM. This document describes how to generate credentials for Windows VMs.

You can also use this process to generate new credentials if you no longer have the original credentials. If you use this process to generate new credentials for existing users, any data that is encrypted with the current credentials, such as encrypted files or stored passwords, might not be retained. If the VM is running an Active Directory domain controller, generating new credentials can cause the password of an existing domain user to be reset or a new domain user to be created.

Accounts disabled by default

The following accounts are built-in to Windows Server and are disabled by default:

  • Administrator
  • Guest
  • DefaultAccount
  • WDAGUtilityAccount

For these accounts, the Windows guest agent can reset the credentials. Resetting the credentials won't do the following:

  • Enable a disabled built-in account
  • Set additional policies so that the user can sign in to the VM

The built-in accounts are not guaranteed to have the default names because the local security policy, which is used by many organizations, can rename the accounts. If the accounts were renamed, you can use the original names.

Before you begin

Generating credentials

Generate credentials for Windows Server VMs by using the Google Cloud Console or the gcloud command-line tool.

Console

  1. Go to the VM instances page.

    Go to the VM instances page

  2. Click the Windows Server VM to change the password on.

  3. On the VM instance details page, in Remote access, click Set Windows password.

  4. In the Username field, enter the username to change the password for, or enter a new username to create a new user.

  5. Click Set.

gcloud

  1. Run the following gcloud compute reset-windows-password command:

    gcloud compute reset-windows-password VM_NAME
    

    Replace VM_NAME with the name of the VM to change the password for.

  2. Review the information in the confirmation prompt:

    This command creates an account and sets an initial password for the
    user [username] if the account does not already exist.
    If the account already exists, resetting the password can cause the
    LOSS OF ENCRYPTED DATA secured with the current password, including
    files and stored passwords.
    
    For more information, see:
    https://cloud.google.com/compute/docs/operating-systems/windows#reset
    
    Would you like to set or reset the password for [username] (Y/n)?
    
  3. After confirming the previous prompt, review the confirmation of new credentials, which appears as follows:

    Resetting and retrieving password for [username] on [instance-name]
    Updated [https://www.googleapis.com/compute/v1/projects/project-name/zones/zone/instances/instance-name].
    ip_address: ip-address
    password:   password
    username:   username
    
  4. You can now connect to the instance by using the new credentials.

Changing passwords

After you connect to your Windows Server VM, you can use the Windows Command Prompt or the Windows user interface to change your password.

Command Prompt

  1. Use the net user command to change the password.

Windows Server 2012 R2

  1. After the desktop finishes loading, click the Start menu icon.

  2. Click Control Panel.

  3. Under the User Accounts icon, click either Change Account Type or Add or remove user accounts.

  4. Select the account that you want to modify.

  5. Click Change the password.

  6. Enter your current password and your new password.

  7. Click Change password to save your changes.

Windows Server 2016

  1. After the desktop finishes loading, click the Start menu icon.

  2. Click Control Panel.

  3. Under the User Accounts icon, click either Change Account Type or Add or remove user accounts.

  4. Select the account that you want to modify.

  5. Click Change the password.

  6. Enter your current password and your new password.

  7. Click Change password to save your changes.

Windows Server 2019

  1. After the desktop finishes loading, click the Start menu icon.

  2. Click Settings.

  3. Click Accounts.

  4. Click Sign-in options.

  5. Under Password, click Change.

  6. Enter your current password and click Next.

  7. Enter your New password, in Reenter password enter the new password again, enter a Password hint, and click Next.

  8. Click Finish.

What's next