I just ran the above and this how it ends.. Any help is much appreciated.
Thanks.

==> amazon-ebs: Restarting Machine
==> amazon-ebs: Waiting for machine to restart...
    amazon-ebs: A system shutdown is in progress.(1115)
    amazon-ebs: WIN-R6G2K20J120 restarted.
    amazon-ebs: #< CLIXML
    amazon-ebs: <Objs Version="1.1.0.1" xmlns="
http://schemas.microsoft.com/powershell/2004/04";><Obj S="progress"
RefId="0"><TN
RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64
N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first
use.</AV><AI>0</AI><Nil
/><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD>
</SD></PR></MS></Obj></Objs>
==> amazon-ebs: Machine successfully restarted, moving on
==> amazon-ebs: Provisioning with Powershell...
==> amazon-ebs: Provisioning with powershell script:
./scripts/restart_check.ps1
    amazon-ebs: 12/06/2018 19:38:44 Starting the Clean up ...
    amazon-ebs: MSI Process Is Running
    amazon-ebs: 12/06/2018 19:38:44Checking for post installation
completion...
    amazon-ebs: installreRunning Result = System.Diagnostics.Process
(msiexec)
    amazon-ebs: 12/06/2018 19:38:44 Restart is still in progress with post
installation steps ...
    amazon-ebs: 12/06/2018 19:38:54Checking for post installation
completion...
    amazon-ebs: installreRunning Result = System.Diagnostics.Process
(msiexec)
    amazon-ebs: 12/06/2018 19:38:54 Restart is still in progress with post
installation steps ...
    amazon-ebs: 12/06/2018 19:39:04Checking for post installation
completion...
    amazon-ebs: installreRunning Result = System.Diagnostics.Process
(msiexec)
    amazon-ebs: 12/06/2018 19:39:04 Restart is still in progress with post
installation steps ...
    amazon-ebs: 12/06/2018 19:39:14Checking for post installation
completion...
    amazon-ebs: installreRunning Result = System.Diagnostics.Process
(msiexec)
    amazon-ebs: 12/06/2018 19:39:14 Restart is still in progress with post
installation steps ...
    amazon-ebs: 12/06/2018 19:39:24Checking for post installation
completion...
    amazon-ebs: installreRunning Result = System.Diagnostics.Process
(msiexec)
    amazon-ebs: 12/06/2018 19:39:24 Restart is still in progress with post
installation steps ...
    amazon-ebs: 12/06/2018 19:39:25 Finished Cleaning up
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: Script exited with non-zero exit status: 1.
Allowed exit codes are: [0]

==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Script exited with non-zero exit status: 1. Allowed exit
codes are: [0]


On Thu, Dec 6, 2018 at 11:03 AM Subha <[email protected]> wrote:

> I also tried to add the below script as a seperate powershell script to
> run after the windoes-restart. But the Instance gets terminated before this
> script finishes.
>
> {
>       "type": "windows-restart",
>       "restart_check_command": "powershell -command \"& {Get-Process |
> Where-Object { $_.Name -ne 'msiexec'};}\"",
>       "restart_timeout": "30m"
>     },
>     {
>       "script": "./scripts/restart_check.ps1",
>       "type": "powershell"
>     }
>
>
>
> "restart_Checks.ps1"
> ----------------------------------
> #############First check if msiexec is running, if not wait until it
> starts.#############
> while ($true)
> {
>     if ((Get-Process -Name msiexec -ErrorAction SilentlyContinue) -eq
> $null)
>     {
>
>         Write-Host -ForegroundColor Red "MSI Process Is Not Running"
>
>     }
>     else
>     {
>         write-host -ForegroundColor Green "MSI Process Is Running"
>         break;
>     }
>
>     Start-Sleep -Seconds 10
> }
>
> #########Once msiexc is started running, wait until it gets
> finished.#############
>   while ($true)
>  {
>    $isInstallerRunning=""
>    Write-Host "$(Get-Date)Checking for post installation completion..."
>    $isInstallerRunning = Get-Process | Where-Object { $_.Name -like
> "msiexec" }
>    Write-Host "installreRunning Result = $isInstallerRunning"
>     if (-not ([string]::IsNullOrEmpty($isInstallerRunning)))
>     {
>       Write-Host "$(Get-Date) Restart is still in progress with post
> installation steps ..."
>       Start-Sleep -Seconds 10
>     }
>     else
>     {
>       Write-Host "$(Get-Date) msiexec is not running anymore"
>        break;
>     }
>  }
>
> On Thu, Dec 6, 2018 at 10:52 AM Subha <[email protected]> wrote:
>
>> Hi Alvaro,
>>
>> Thank you, Which Script are you referring to? I dont see any script in
>> the documentation.
>> https://www.packer.io/docs/provisioners/windows-restart.html#restart_check_command
>>
>> It just uses a powershell command.
>> Can you please give me more specific. Thank you and sorry if its to much
>> to ask. I am a newbie here.
>>
>> Thanks for your help
>>
>>
>>
>> On Thu, Dec 6, 2018 at 4:34 AM Alvaro Miranda Aguilera <[email protected]>
>> wrote:
>>
>>> well
>>>
>>> packer need that to confirm machine is up and running again
>>>
>>> a script like the example in the documentation is you need for the
>>> restart part
>>>
>>> --
>>> This mailing list is governed under the HashiCorp Community Guidelines -
>>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>>> violation of those guidelines may result in your removal from this mailing
>>> list.
>>>
>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>> IRC: #packer-tool on Freenode
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Packer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/packer-tool/CAHqq0eyHx7umvcHtKFN4sp6RZ27x6L04bBhwFFqyhbE7cW9p1w%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/packer-tool/CAHqq0eyHx7umvcHtKFN4sp6RZ27x6L04bBhwFFqyhbE7cW9p1w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CAEDMBCxV7B0qBTM5LUUTKZ1vk7a9865Jj93GOET7brf4jF49mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to