Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

vm startup script using metadata

BBB
Bronze 1
Bronze 1

I created a VM using the windows server 2019 datacenter. After I created it, I added a metadata item with key and value like this to test it:

key1: windows-startup-script-cmd

value1:

dir

pause

The problem is that I don't see the cmd window run with the "dir" command using Windows RDP to log in. Is there anything wrong with my setting?

What I want to do is to run commands to open a URL and a program every time it starts up without me logging in.

The setting I followed: Using startup scripts on Windows VMs 

 

0 1 1,006
1 REPLY 1

The script is run at machine start not at login.  `dir` is only sending output so hard to measure if it ran, one thing you could do is perform a task that has something you could check.  For example you could create a file with: 

echo > c:\newfile.txt

 Then when you login you can see if that file exists to show that it ran successfully.