Run a Start up Script Windows using Metadata on GCE Console

2,019 views
Skip to first unread message

Guillermo Musumeci

unread,
Mar 5, 2015, 3:17:20 PM3/5/15
to gce-dis...@googlegroups.com
Hello,

I can launch a start up script to install some Windows applications when I create a VM using gcloud compute instances create.

However when I tried to do the same on the Google Developer Console is not working.

I'm trying to execute a PowerShell script when the sysprep finished. 

Not sure if I need to paste the script or copy to Google Storage.

When I run the gcloud compute instances create I used a local file.

I tried few options and is not working. I can't found any documentation.

Not fun to try and error when you are paying for compute resources.

Anyone can help?

Thanks! Guillermo

Josh Moyer

unread,
Mar 5, 2015, 3:56:06 PM3/5/15
to Guillermo Musumeci, gce-dis...@googlegroups.com
Hi Guillermo,
There is documentation for startup scripts at [1].  The documentation covers using startup scripts with Windows on a separate page at [2] and using startup scripts that are stored on Google Cloud Storage, which is required if your script causes the metadata to exceed 32KiB.

Kind Regards,
Josh Moyer
Google Cloud Platform Support


--
© 2014 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/9e04de02-a953-4848-b83f-bd0276b7dfaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks,
Josh

Guillermo Musumeci

unread,
Mar 5, 2015, 4:19:49 PM3/5/15
to gce-dis...@googlegroups.com, gmus...@gmail.com
Hi Josh,

Look like my question was not clear enough.

I read these 2 pages hours ago and was able to run a startup script using the Google Cloud SDK shell with following command:

gcloud compute instances create "gcekopic01" --image windows-2008-r2 --zone "europe-west1-d" --machine-type "g1-small" --metadata "gce-initial-windows-user=kopiadmin" "gce-initial-windows-password=S3cur3P@ssw0rd" --metadata-from-file sysprep-oobe-script-ps1="D:/KopiCloud/GCE-Chocolatey-Adobe.ps1" --boot-disk-type "pd-standard" --boot-disk-device-name "gcekopic01"

My problem is when I tried to launch for the console. I tried the option with the path using both /  and \ both is not working....

Josh Moyer

unread,
Mar 6, 2015, 1:58:37 PM3/6/15
to Guillermo Musumeci, gce-dis...@googlegroups.com
Hi Guillermo,
Yes, that's working as intended.  In the Developers Console you would need to include the actual script and not its file path since the Developers Console doesn't support reading metadata from files.

Kind Regards,
Josh Moyer
Google Cloud Platform Support
Reply all
Reply to author
Forward
0 new messages