A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/compute/docs/instances/windows/connecting-powershell below:

Connect to Windows VMs using PowerShell | Compute Engine Documentation

Connect to Windows VMs using PowerShell

Stay organized with collections Save and categorize content based on your preferences.

Windows

This document describes how to connect to a Windows virtual machine (VM) instance by using PowerShell.

Note: When a user connects to a VM, that user can use all of the IAM permissions granted to the service account attached to the VM. Before you begin Connect using PowerShell

If you have a Windows workstation with PowerShell, you can connect to your Windows Server instances through a remote PowerShell session.

  1. If you have not created a username and password on the remote Windows instance yet, create or reset your Windows password.

  2. Add a firewall rule that opens port 5986 on the Google Cloud VPC network where your Windows Server instance is located.

  3. On your local workstation, open the PowerShell terminal.

  4. Optional: You can initialize a variable to hold your user credentials so you do not need to enter them each time you connect to the instance. If you skip this step, you receive a prompt for your username and password later.

    $credentials = Get-Credential
    
  5. Choose whether you want to establish an interactive Powershell session, or invoke commands on your Windows Server VM remotely.

Establish an interactive PowerShell session

To establish a PowerShell session, run the following command:

Enter-PSSession -ComputerName IP_ADDRESS -UseSSL -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck) -Credential $credentials

Replace IP_ADDRESS with the external IP address, DNS name, or Windows computer name for the instance to which you want to connect.

Note: You can find the external IP address of your Windows instance either in the Google Cloud console on the VM Instances page, or in the Google Cloud CLI by running gcloud compute instances list.

After you connect, the command prompt changes to include the IP address of the remote Windows instance. You can now use the terminal to run PowerShell commands on the remote Windows Server instance.

Invoke commands on your Windows Server VM remotely

As an alternative to the Enter-PSSession command, you can run Invoke-Command with the -ScriptBlock flag to execute PowerShell commands on the remote instance without establishing an interactive session.

Invoke-Command -ComputerName IP_ADDRESS -ScriptBlock { SCRIPT } -UseSSL -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck) -Credential $credentials

Replace the following:

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This document guides you through connecting to a Windows virtual machine (VM) instance using PowerShell, enabling remote management and command execution."],["Before connecting, ensure you have set up authentication via the Google Cloud CLI or are using the Google Cloud console, and have created or reset your Windows password on the remote instance."],["Connecting to a Windows Server instance requires opening port 5986 in your Google Cloud VPC network's firewall rules, in order to accept remote PowerShell connections."],["You can establish either an interactive PowerShell session using `Enter-PSSession` or remotely invoke commands on the VM without an interactive session by using the `Invoke-Command` method."],["When a user connects to a VM, they can utilize all IAM permissions granted to the service account attached to that specific VM."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4