Windows 2016 AMI AWS error

28 views
Skip to first unread message

James W

unread,
Apr 9, 2018, 2:13:16 AM4/9/18
to Packer
Hi,

I am trying to build a Windows 2016 AMI for AWS, attached is my build.json file. I am getting an error when trying to run "InitializeInstance.ps1 -Schedule" as inline commands. 

==> amazon-ebs: Provisioning with Powershell...
==> amazon-ebs: Provisioning with powershell script: C:\Users\ADMINI~1\AppData\Local\Temp\2\packer-powershell-provisioner933417395
    amazon-ebs: C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 : The
    amazon-ebs: term 'C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1'
    amazon-ebs: is not recognized as the name of a cmdlet, function, script file, or operable
    amazon-ebs: program. Check the spelling of the name, or if a path was included, verify
    amazon-ebs: that the path is correct and try again.
    amazon-ebs: At C:\Windows\Temp\script-5acaf9bd-4306-241c-77fd-d6adb74e86bd.ps1:1 char:1
    amazon-ebs: + C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1
    amazon-ebs: -Schedul ...
    amazon-ebs: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    amazon-ebs:     + CategoryInfo          : ObjectNotFound: (C:\ProgramData\...izeInstance.p
    amazon-ebs:    s1:String) [], CommandNotFoundException
    amazon-ebs:     + FullyQualifiedErrorId : CommandNotFoundException
    amazon-ebs:
==> amazon-ebs: Stopping the source instance... 


Has anyone else run into this error ?

James
Windows 2016 Base.json

Megan Marsh

unread,
Apr 9, 2018, 1:19:52 PM4/9/18
to packe...@googlegroups.com
Are you sure your file InitializeInstance.ps1 exists on the guest already? you may need to put it in place with the file provisioner before running your powershell provisioner.
Reply all
Reply to author
Forward
0 new messages