0

Is there any Get-GCE* PowerShell command that will do the same as "gcloud compute networks subnets list"? I have installed the latest Google Cloud SDK and PowerShell cmdlet's.

2 Answers 2

0

Yes,Check the Quick Star on how to enable Cloud Tools for PowerShell, authenticate with the Cloud SDK.

After, as described Here you can run

PS C:\> Get-GceNetwork

Syntax

Get-GceNetwork

  [-Project <String>]

  [-Name] <String[]>

  [<CommonParameters>]

Here is list of Cloud Tools for PowerShell of cmdlets that lets you manage Google Cloud Platform resources.

1
  • Thanks. However IPv4Range always seems to be null. Is there away to expand the links for the subnets into redable objects? (Get-GceNetwork).Subnetworks Jan 7, 2019 at 5:43
-1

The Powershell cmdlets do not seem to provide this data.

My approach has been to use the gcloud command line tool with JSON output. Powershell can digest this easily so there is no additional parsing required. I have had to do this for both projects and networks.

foreach($p in (gcloud projects list --format=json --quiet| ConvertFrom-Json))
{
    foreach($n in (gcloud compute networks subnets list --format=json --quiet --project $p.projectId | ConvertFrom-Json))
    {

    }
}
1
  • Hello and welcome to stack exchange. You could make this answer better with a little explanation of that code - what it does, why it solves the problem. Oct 3, 2020 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .