Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Google Compute Engine (GCE) is a service provided by Google Cloud Platform (GCP) that allows users to create and manage virtual machines (VMs) on Google's infrastructure. While GCE is platform-agnostic and can run various operating systems, including Windows, this article will focus on how to create and manage GCE instances using Windows CMD and PowerShell.
First, install the Google Cloud SDK on your Windows machine:
gcloud init
You can create a new GCE instance using the gcloud
command in CMD. Here’s an example of how to create a basic VM instance:
gcloud compute instances create my-windows-instance --zone=us-central1-a --machine-type=n1-standard-1 --image-family=windows-2019 --image-project=windows-cloud
my-windows-instance
: Name of the instance.us-central1-a
: Zone where the instance will be created.n1-standard-1
: Machine type.windows-2019
: Image family for Windows Server 2019.windows-cloud
: Image project.After creating the instance, you can connect to it using PowerShell. You need the external IP address of the instance and the auto-generated password for the default user.
Retrieve the external IP address of your instance:
gcloud compute instances list --filter="name=my-windows-instance"
Set up a password for the Windows user:
gcloud compute reset-windows-password my-windows-instance --zone=us-central1-a --user=USERNAME
Replace USERNAME
with your desired username. This command will output the generated password.
Open PowerShell and use the mstsc
command to connect:
mstsc /v:EXTERNAL_IP
Replace EXTERNAL_IP
with the IP address retrieved earlier.
You can manage your instance using various gcloud
commands in PowerShell. Here are some examples:
Start an Instance:
gcloud compute instances start my-windows-instance --zone=us-central1-a
Stop an Instance:
gcloud compute instances stop my-windows-instance --zone=us-central1-a
Delete an Instance:
gcloud compute instances delete my-windows-instance --zone=us-central1-a
Managing Google Compute Engine instances from a Windows environment is straightforward with the Google Cloud SDK and the gcloud
command-line tool. By following the steps outlined above, you can easily create, connect to, and manage your GCE instances using CMD and PowerShell.