I've installed the gcloud CLI according to https://cloud.google.com/sdk/docs/install.
When using cloud shell on browser, I could simply paste a script and it would work. But it won't do the same when using cloud CLI on cmd or Powershell.
Sample script:
# List accessible projects
PROJECTS=$(\
gcloud projects list \
--format="value(projectId)")
# Iterate over each Project
for PROJECT in ${PROJECTS}
do
# output project
echo "Project: ${PROJECT}"
# Enumerate snapshots and properties
gcloud compute snapshots list \
--project=${PROJECT} \
--filter="creationTimestamp<'2022-06-21'" \
--format="csv(name,status,diskSizeGb,storageLocations,creationTimestamp)"
done
Result on browser cloud shell: a list of snapshots
Result on cmd: https://imgur.com/oUJNuV3
Result on Powershell: https://imgur.com/a/tZ20h32