Hi,
I started to have issue with win 2019 build not sure due to the latest windows 2019 server update or some other reason.
I’m passing the parameter to phase-1 like this:
“provisioners”: [
{
“type”: “powershell”,
“elevated_user”: “packeradm”,
“elevated_password”: “{{ user `winrm_pass` }}”,
“script”: “D:/Packer/hv-packer-master/extra/scripts/phase-1.ps1”
In the variables json I have the winrm pass like this:
“winrm_pass”: “password”
When packer started to run on a cloned vm for build, on the cloned machine’s
packer-elevated-shell-65f7f416-624c-da8f-19ac-f8b8aeafbfc8.ps1
have this line
$f.RegisterTaskDefinition($name, $t, 6, “packeradm”, $password, $logon_type, $null) | Out-Null
which ends up with the following error:
A specified logon session does not exist. It may already have been terminated. (Exception from HRESULT: 0x80070520) At C:\Windows\Temp\packer-elevated-shell-65f7f416-624c-da8f-19ac-f8b8aeafbfc8.ps1:60 char:1
+ $f.RegisterTaskDefinition($name, $t, 6, "packeradm", $password, $logo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Logon works with the packeradm user perfectly not sure what happened that breaks the build process at this point.