This page shows how to enable Cloud Tools for PowerShell, authenticate with the Cloud SDK, and run PowerShell cmdlets.
Before you begin
Complete the following steps:
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
In the Google Cloud Console, on the project selector page, select or create a Google Cloud project.
Make sure that billing is enabled for your Cloud project. Learn how to confirm that billing is enabled for your project.
- Install the Cloud SDK from the PowerShell command line by running the following command as an administrator:
Authenticate with Cloud SDK
Cloud Tools for PowerShell uses your credentials and settings stored in the Cloud SDK to enable the cmdlets. To use the cmdlets, first log in using the Cloud SDK:
At the command prompt, run the following command:
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
In your browser, log in to your Google user account when prompted and click Allow to grant permission to access Google Cloud resources.
At the command prompt, select a Google Cloud project in which you have Owner, Editor, or Viewer permissions:
Pick a cloud project to use:  [my-project-1]  [my-project-2] ... Please enter your numeric choice:
Run PowerShell cmdlets
After authenticating, you can start using Cloud Tools for PowerShell. Open 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 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 ---- ------ my-vm-1 TERMINATED
Navigate Cloud Storage with PowerShell provider
Cloud Tools for PowerShell includes a PowerShell provider for
Cloud Storage. This provider allows you to use commands like
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 Cloud Storage cd gs:\ # Show the available buckets ls # Create a new bucket mkdir my-new-bucket
You can also make the Cloud Storage provider available in any
PowerShell session by importing the Cloud Tools for PowerShell module via
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 PowerShell: