Hello, Himanshu.
I think this can help you.
I have tested this 2 entries against Windows instances (Win Server 2016 and 2019) and for both cases it works fine.
So when you are settting up your Windows instance use the following in the Metadata section:
Key field: sysprep-specialize-script-ps1
Value field:
Write-Host "Install Monitoring agent"
cd C:\Users\Public\Downloads\
.\StackdriverMonitoring-GCM-46.exe /S;
When you spin your instance this startup script in PowerShell will do the job for you.
If you are looking for the same in linux environment, I have found this (but I didn't have the time to test it).
When you are setting up your instance in the Startup Script section, you can use the following:
#! /bin/bash
sudo bash add-monitoring-agent-repo.sh
#CentOS/RHEL
sudo yum install -y stackdriver-agent
sudo service stackdriver-agent start
#Debian/Ubuntu
sudo apt-get update
sudo apt-get install stackdriver-agent -Y
#Restarting the service works for both
sudo service stackdriver-agent start