Unable to set registry values in Windows using Packer for Azure

Hi all.

I am building some VDI images for Windows 10 multi-session in Azure. I install about a dozen apps, add some users, etc. Everything works great except that I cannot figure out how to set registry values. I am assume this is a security issue (UAC). What confuses me is that I am performing other administrative tasks (like creating a local admin). Is there a trick to set registry values? My Powershell statements are correct, it’s just that I cannot get them to take when running the Packer build process. Is there a way to elevate and bypass UAC?

Thank you to anyone who can help. I have been working on this for several days.

I am using the inline method:

In the doc I see ways to enter the elevated user/password but this image I am building has not user (that I have created). I could create one and use that, but this seems strange. Why can I create an admin user successfully, change execution policy, etc. but not create a reg key.

Some other general questions that I am unclear on after reading the doc:

  • Is the “Packer” user, that is used for WinRM connections, an admin? I assume so
    *Does the Packer user run with UAC suppressed? I am unclear on this
    *What magic does Packer user to create the Packer user on the vanilla VM? I assume it uses the Azure VM Agent once the VM is online

Thanks in advance all.