Assign PowerShell script to run at startup using PowerShell on Window Server 2012

Posted by James Toyer on Server Fault See other posts from Server Fault or by James Toyer
Published on 2012-12-05T17:13:46Z Indexed on 2014/06/02 9:31 UTC
Read the original article Hit count: 310

I'm trying to write a PowerShell script that will run when a Windows 2012 instance is created on AWS using the configuration tools provided by AWS.

My problem is that I want to change the name of the machine once it has started up, restart the machine and carry on set up process after. The main reason for this is that one of the applications, Boundary, installed in the set up process takes the name of the server when first installed. It is then doesn't seem possible to change it's name in their portal.

Ideally I would have two PowerShell scripts, one to start the set up process, initialised through AWS and another that runs the first time the machine restarts. This second script would ideally be queued to run on the next start by the initial set up script. So I guess my question are:

  1. Is this possible?
  2. How would I go about doing this.

My Google foo is letting me down here so any answers would be appreciated.

© Server Fault or respective owner

Related posts about amazon-web-services

Related posts about windows-server-2012