New Question
0

Run a cmd after host name reboot

asked 2017-08-09 23:01:49 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

On Windows 10, the VM reboots after the host name gets set. On the subsequent boot I want to run a powershell script (to join domain). My question is how do I specify that the script is to only run after the VM reboots?

Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2017-08-10 02:49:23 +0200

alexpilotti gravatar image

Cloudbase-Init has actions performed at various stages (called plugins). The one that sets the hostname (and needs a reboot because that's what Windows requires unfortunately) comes before the userdata or the localscripts ones.

If you are using OpenStack, I would recommend to pass a userdata PowerShell script that joins the domain, e.g. using djoin.exe:

#ps1
& djoin.exe /requestODJ /loadfile <blob_txt_file> /windowspath $ENV:SystemRoot /localos
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-08-09 23:01:49 +0200

Seen: 623 times

Last updated: Aug 10 '17