Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$f.RegisterTaskDefinition started to fail with "A specified logon session does not exist." #12892

Closed
Badb0yBadb0y opened this issue Mar 18, 2024 · 3 comments

Comments

@Badb0yBadb0y
Copy link

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.

Copy link

Hi 👋 thanks for reaching out.

For general questions we recommend reaching out to the [community forum](https://discuss.hashicorp.com/c/packer) for greater visibility.
As the GitHub issue tracker is only watched by a small subset of maintainers and is really reserved for bugs and enhancements, you'll have a better chance of finding someone who can help you in the forum.
We'll mark this issue as needs-reply to help inform maintainers that this question is awaiting a response.
If no activity is taken on this question within 30 days it will be automatically closed.

If you find the forum to be more helpful or if you've found the answer to your question elsewhere please feel free to post a response and close the issue.

Copy link

Hi,

This issue has not received any update in the last 3 weeks, and will automatically be closed in 7 days if it does not receive any activity by then.

If you find the community forum to be more helpful or if you've found the answer to your question elsewhere please feel free to post a response and close the issue.

@github-actions github-actions bot added the Stale label Apr 11, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant