Skip to main content
VM Snooze SousChef

GCP Stopped InstancesLister

Professional PowerShell script that discovers and analyzes stopped compute instances across Google Cloud Platform projects. Fast gcloud CLI integration with comprehensive CSV + HTML reporting for resource optimization.

Blaze
Blaze says:'Stopped' doesn't mean 'free' -- your attached persistent disks keep billing even when the VM is off. Use -MinDays 30 to find the long-term sleepers, then check if you can snapshot and delete those disks too.
Quick Start
# List all stopped instances
.\GCP-StoppedInstances.ps1
# Filter by age (30+ days)
.\GCP-StoppedInstances.ps1 -MinDays 30
# Specific projects
.\GCP-StoppedInstances.ps1 -ProjectIds"project1,project2"

Stopped instance audit quick start

Structured quick-reference sections for prerequisites, installation, usage, and troubleshooting.

Prerequisites

  • PowerShell 5.1+ or PowerShell Core for script execution
  • Google Cloud CLI (`gcloud`) installed and authenticated
  • Viewer-level access to target GCP projects and Compute Engine metadata
  • Local output directory for CSV + HTML reports

Common parameters

ParameterPurposeExample
-MinDaysFilters stopped instances by age30
-ProjectIdsTargets specific GCP projects"project1,project2"
-ZonesLimits scope to specific zones (if supported in your script version)"us-central1-a,us-east1-b"

Project scoping is the fastest way to validate output and permissions before broader scans.

Standard run path

  1. 1Run a baseline scan to discover stopped Compute Engine instances across accessible projects.
  2. 2Use `-MinDays 30` to focus on long-term stopped instances that are more likely cleanup candidates.
  3. 3Review attached persistent disks and static IPs before deciding on deletion or decommissioning.
  4. 4Use owner labels and project context to route follow-up to the right teams.
PowerShell
.\\GCP-StoppedInstances.ps1
PowerShell
.\\GCP-StoppedInstances.ps1 -MinDays 30
PowerShell
.\\GCP-StoppedInstances.ps1 -ProjectIds "project1,project2" -MinDays 30

Outputs and prioritization

CSV + HTML output usage

SignalWhy it mattersAction
Stopped durationSeparates temporary shutdowns from likely zombiesPrioritize oldest sleepers first
Project + zoneIdentifies owner domain and operational contextAssign reviews to project owners
Owner labelsSpeeds communication and approvalValidate intent before cleanup
Disk/storage contextStopped VMs still incur disk costsSnapshot/delete or resize where appropriate
  • Use the HTML report for stakeholder review and the CSV for sorting by age, project, and cost impact.

Troubleshooting

  • If no resources are returned, confirm `gcloud auth list` and project visibility in the active account.
  • If some projects fail, start with explicit `-ProjectIds` and verify IAM access per project.
  • If scans are slow across many projects/zones, split the run by project group and compare outputs afterward.

Storage charges continue

Stopped GCE instances stop compute billing, but attached persistent disks and some network resources may continue billing until cleaned up.

PowerShell + gcloud CLI Excellence

Comprehensive analysis and reporting for stopped GCP compute instances with enterprise-grade performance

gcloud CLI Integration

Native integration with Google Cloud CLI for authenticated access and reliable data retrieval

Parallel Processing

High-performance parallel scanning across projects and zones with configurable concurrency limits

Multi-Project Discovery

Automatically discovers all accessible projects or targets specific projects for focused analysis

Zone Intelligence

Smart zone discovery with filtering capabilities and support for zone-specific targeting

Owner Detection

Extracts owner information from GCP labels for accountability and lifecycle management

Age Analysis

Calculates days since instance creation with configurable age-based filtering for lifecycle decisions

Dual Report Formats

Generates both CSV (for analysis) and HTML (for executive reporting) with comprehensive breakdowns

Performance Tracking

Real-time progress tracking with performance metrics and API call monitoring

Usage Examples

Real-world scenarios for GCP instance lifecycle management and optimization

Complete Organization Scan

.\GCP-StoppedInstances.ps1

Discovers all stopped instances across your entire GCP organization with automatic project and zone discovery.

Age-Based Filtering

.\GCP-StoppedInstances.ps1 -MinDays 30

Focuses on instances stopped for 30+ days for lifecycle management and potential cleanup decisions.

Targeted Project Analysis

.\GCP-StoppedInstances.ps1 -ProjectIds"project1,project2"

Analyzes specific projects for focused resource management and compliance reporting.

Zone-Specific Scanning

.\GCP-StoppedInstances.ps1 -Zones"us-central1-a,us-east1-b"

Limits analysis to specific zones for targeted optimization and reduced API calls.

Technical Specifications

Enterprise-grade PowerShell script with comprehensive GCP instance discovery capabilities

Requirements

PowerShell 5.1+

Modern PowerShell with parallel job support and advanced cmdlets

Google Cloud SDK

gcloud CLI installed and configured with proper authentication

GCP Authentication

Active gcloud authentication with access to target projects

IAM Permissions

Compute Engine Viewer role or equivalent permissions across target projects

Network Connectivity

Internet access to Google Cloud API endpoints

Command Line Parameters

-ProjectIds

Comma-separated list of GCP project IDs to scan

-Zones

Comma-separated list of specific zones to scan

-MinDays

Minimum days since creation to include instances (default: 0)

-MaxConcurrent

Maximum number of concurrent operations (default: 10)

-SkipZones

Comma-separated list of zones to skip during scanning

Core Features

Discovery Engine

  • • Automatic project and zone discovery via gcloud CLI
  • • Parallel processing with configurable concurrency limits
  • • PowerShell job-based parallel execution
  • • Comprehensive error handling and retry logic

Data Processing

  • • Instance age calculation with timezone handling
  • • Owner extraction from GCP labels and tags
  • • Machine type, region, and zone analysis
  • • Disk size calculation and storage analysis

Reporting Capabilities

  • • CSV export for data analysis and integration
  • • Rich HTML reports with visual breakdowns
  • • Age distribution analysis with priority levels
  • • Project and region distribution charts

Performance Optimization

  • • Concurrent gcloud API calls with job management
  • • Progress tracking and performance metrics
  • • Configurable concurrency limits for rate limiting
  • • Memory-efficient data processing and aggregation

Comprehensive Reporting

Professional reporting in multiple formats with detailed analytics and visual breakdowns

CSV Data Export

Structured CSV export optimized for data analysis, filtering, and integration with business intelligence tools.

Instance details and configuration
Age analysis and creation timestamps
Owner information from label analysis
Project and zone organization
Machine type and disk size details

HTML Executive Report

Rich HTML report with visual analytics, age distribution charts, and executive-friendly presentation for stakeholder communication.

Executive summary with key metrics
Age distribution with priority levels
Project and region breakdowns
Top oldest instances analysis
Performance metrics and API statistics

Chef's Tips & Best Practices

Professional recommendations for effective GCP instance lifecycle management

gcloud CLI Setup

Ensure gcloud is properly authenticated and configured before running the script. Like prepping your kitchen tools, proper setup ensures smooth operation.

Performance Tuning

Start with 5-10 concurrent jobs for large organizations to balance speed and API rate limits. Like managing multiple burners, find the right balance for your environment.

Project Strategy

Use project filtering for focused analysis or to avoid projects with restricted access. Target specific projects like a chef selecting ingredients from trusted suppliers.

Age-Based Filtering

Start with 30+ day filters for initial cleanup identification. Like aging ingredients, some instances need time, but others may be forgotten and ready for cleanup.

Owner Engagement

Use the owner detection to reach out before cleanup decisions. The script identifies owners through GCP labels, enabling proactive communication about instance lifecycle.

Report Integration

Import CSV reports into analytics tools for trend analysis. The structured output enables executive dashboards and automated lifecycle management workflows.

Ready to Optimize Your GCP Resources?

Download the GCP Stopped Instances Lister and start identifying optimization opportunities in your Google Cloud Platform today. PowerShell + gcloud CLI excellence for comprehensive instance discovery.

What to do next

Pick the path that fits where you are right now.

Trust & run-safety metadata

Key execution details for GCP VM Snooze SousChef so users know what they are downloading or running before they act.

Need verification guidance? See Security & Trust and Responsible Disclosure.

Read-only / reportingGitHub sourceExplicit + inferred metadata

Maintainer

CloudCostChefs

Last Updated

July 4, 2025

Last Tested

February 23, 2026

Minimum Access

Read-only Compute Engine visibility across the target GCP projects plus `gcloud` auth access

Execution Type

GitHub-hosted PowerShell reporting script (GCP stopped instance inventory)

Version

2025-07-04

SHA256 Checksum

Not published yet (recommend adding checksum for downloadable files)

Verification Notes

GitHub-hosted GCP reporting script. Confirm `gcloud` authentication, project scope, and concurrency settings before scheduled use.

Safe Usage Checklist

  • Check for intentionally stopped instances used for DR, licensing, or maintenance windows before remediation.
  • Limit initial runs to a small set of projects to validate output and rate-limit behavior.
  • Run in a non-production subscription/account/tenancy first and capture sample output before broader rollout.
  • Use least-privilege access. Current best hint from docs: Read-only Compute Engine visibility across the target GCP projects plus `gcloud` auth access.

Quick start (fast path)

Minimal steps to safely get value from this tool without reading the entire page first.

Estimated time: 5-10 minutes per projectDifficulty: IntermediateAccess: Review / read-only
  1. 1. Confirm scope and permissions

    Use least privilege and test in a non-production scope first. Minimum access hint: Read-only Compute Engine visibility across the target GCP projects plus `gcloud` auth access.

  2. 2. Get the tool package / source

    View on GitHub and review the files before running.

    GitHub
  3. 3. Check prerequisites

    • ✅ PowerShell 5.1+ with parallel job support and advanced cmdlets
    • ✅ Google Cloud SDK (gcloud CLI) installed and properly configured
    • ✅ Active gcloud authentication with access to target GCP projects
  4. 4. Run safely and review output

    GitHub-hosted GCP reporting script. Confirm `gcloud` authentication, project scope, and concurrency settings before scheduled use. Start with a small sample scope, then expand once results look correct.