I am running the following command to reset the password for a Windows VM and get the results in JSON format:
gcloud compute reset-windows-password \
VM_NAME \
--project=PROJECT_ID \
--quiet \
--zone=ZONE \
--format=json \
--verbosity=none
The following is printed to stdout:
Resetting and retrieving password for [USERNAME] on [VM_NAME]
Updated [https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME].
{
"ip_address": "1.2.3.4",
"password": "XYZ",
"username": "USERNAME"
}
This is more than the expected JSON, making it difficult to process the output.
What flag am I missing to suppress the first two lines?
gcloud?gcloudflag to do this. I'm curious.The deleted answer on this page is the advice that I would give, namely to try sending stderr to/dev/null(2>/dev/null)gcloudand you should consider filing it as an issue on issuetracker.google.com. As you expect, the JSON output should be to stdout and the extraneous (non-JSON) output to stderr