This page shows how to install Google Cloud Tools for PowerShell, authenticate with the Cloud SDK, and run PowerShell cmdlets.

Before you begin

  1. Sign in to your Google account.

    If you don't already have one, sign up for a new account.

  2. Select or create a Cloud Platform project.

    Go to the Projects page

  3. Enable billing for your project.

    Enable billing

  4. Download and install Google Cloud SDK for Windows, as described in the Quickstart for Windows guide. Alternatively, you can install the module from the PowerShell command line (preferably as an administrator) by running the command Install-Module GoogleCloud. If you install it this way, the first time you use the module, it will run the Cloud SDK installer for you.

Authenticate with the Google Cloud SDK

Google Cloud Tools for PowerShell uses the credentials and settings stored in the Cloud SDK. So in order to start using the cmdlets, you first need to login using the Cloud SDK:

  1. Run the following at a command prompt:

    gcloud init

  2. Accept the option to log in using your Google user account:

    To continue, you must log in. Would you like to log in (Y/n)? Y

  3. In your browser, log in to your Google user account when prompted and click Allow to grant permission to access Google Cloud Platform resources.

  4. At the command prompt, select a Cloud Platform project from the list of those where you have Owner, Editor or Viewer permissions:

    Pick a cloud project to use:
    [1] [my-project-1]
    [2] [my-project-2]
    Please enter your numeric choice:

Run PowerShell cmdlets

Once you have authenticated as described above, you can start using Cloud Tools for PowerShell. Open up a PowerShell window and try running the following commands.

Get all buckets for the current project, for a specific project, or a specific bucket:

$currentProjBuckets = Get-GcsBucket
$specificProjBuckets = Get-GcsBucket -Project my-project-1
$bucket = Get-GcsBucket -Name my-bucket-name

List all Google Compute Engine instances associated with a project:

Get-GceInstance -Project my-project-1 |
    Sort Status |
    Format-Table Name, Status -GroupBy Status

    Status: RUNNING

Name    Status
----    ------
my-vm-2 RUNNING
my-vm-3 RUNNING

    Status: TERMINATED

Name    Status
----    ------

Cloud Tools for PowerShell includes a PowerShell provider for Google Cloud Storage. This provider allows you to use commands like cd, dir, copy and del to navigate and manipulate your data in Cloud Storage as if the data were on a local file system.

To directly use the provider, you can start Cloud Tools for PowerShell using the shortcut from the start menu. This will launch a PowerShell console with the provider loaded:

# Navigate to Google Cloud Storage
cd gs:\
# Show the available buckets
# Create a new bucket
mkdir my-new-bucket

You can also make the Google Cloud Storage provider available in any PowerShell session by importing the Cloud Tools for PowerShell module via “Import-Module GoogleCloud”.

What's next

You can learn more about specific cmdlets by referring to the Cloud Tools for PowerShell cmdlet reference, or by using the built-in help system from within Windows PowerShell:

Get-Help New-GcsBucket

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Tools for PowerShell