Google Cloud PowerShell

Quick Hit

It’s easy to run PowerShell in Google Cloud Shell.

Open Cloud Shell:

sudo apt-get install -y powershell

Then:

pwsh
PowerShell 6.1.3
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /home/[USER]>

Then:

https://cloud.google.com/tools/powershell/docs/quickstart

And:

Install-Module GoogleCloud -Scope CurrentUser
NB Because Cloud Shell is Compute Engine instance provisioned per-user, per-session, you’ll need to rerun the installs between sessions.

But you get:

Get-GceDisk
CreationTimestamp           : 2019-03-22T14:09:37.848-07:00
Description :
DiskEncryptionKey :
Id : 8082606374212137470
Kind : compute#disk
LabelFingerprint : 42WmSpB8rSM=
Labels :
LastAttachTimestamp : 2019-03-22T14:09:37.848-07:00
LastDetachTimestamp :
Licenses :
Name : instance-1
Options :
SelfLink : .../disks/instance-1
SizeGb : 10
SourceImage :
SourceImageEncryptionKey :
SourceImageId :
SourceSnapshot :
SourceSnapshotEncryptionKey :
SourceSnapshotId :
Status : READY
Type :
Users :
Zone :.../us-east1-b
ETag :

And:

Get-GceInstance
Get-GceInstance instance-1 -Zone us-east1-b
Name       CpuPlatform   MachineType   Zone       TimeCreated
---- ----------- ----------- ---- -----------
instance-1 Intel Haswell n1-standard-1 us-east1-b 2019-03-22T14:09:37.824-07:00

And so much more, see:

https://googlecloudplatform.github.io/google-cloud-powershell/#/

That’s all!