Packer script to build windows 11 image to vmware workstation

hello there,
i have trying to build windows 11 image to vmware workstation using packer hashicorp. The script run successfully but when reachs at the end it deletes all files in out-vmware folder. and also it stacks at the point of
“==> vmware-iso.windows: Waiting for WinRM to become available…”

let me share my script packer {
required_plugins {
vmware = {
version = “>= 1.0.0”
source = “github.com/hashicorp/vmware
}
vsphere = {
version = “>= 1.0.0”
source = “github.com/hashicorp/vsphere
}
}
}

variable “autounattend_file” {
type = string
default = “answer_file/autounattend.xml”
}

variable “cpu_num” {
type = number
default = 2
}

variable “disk_size” {
type = number
default = 102400
}

variable “mem_size” {
type = number
default = 4096
}

variable “os_iso_checksum” {
type = string
default = “b9e788226074441ca400d802b6cecd602931b14a2eacb0f3646a93403ab04914”
}

variable “os_iso_url” {
type = string
default = “D:/applications/images/Windows 11 Enterprise/SW_DVD9_Win_Pro_11_23H2.3_64BIT_English_Pro_Ent_EDU_N_MLF_X23-69671.iso”
}

variable “winrm_password” {
type = string
default = “packer1234”
sensitive = true
}

variable “winrm_username” {
type = string
default = “administrator”
}

#source “vmware-iso” “windows” {
#iso_url = var.os_iso_url
#iso_checksum = var.os_iso_checksum
#communicator = “none”
#output_directory = “out-vmware”
#disk_size = 10240
#vm_name = “Windows_11_test”
#guest_os_type = “windows11-64”
#}

build {
sources = [“source.vmware-iso.windows”]
}

source “vmware-iso” “windows” {

ISO configuration

iso_url = var.os_iso_url
iso_checksum = var.os_iso_checksum

VM configuration

disk_size = var.disk_size
disk_type_id = 0
guest_os_type = “windows11-64”
vm_name = “Windows_11_template”

communicator = “winrm”
winrm_username = var.winrm_username
winrm_password = var.winrm_password
winrm_timeout = “1h” # Increased timeout

floppy_files = [var.autounattend_file]

Ensure output is saved

output_directory = “out-vmware”

Keep VM registered

keep_registered = true

Add shutdown command

shutdown_command = “shutdown /s /t 5 /f /d p:4:1 /c "Packer Shutdown"”

vmx_data = {
“numvcpus” = var.cpu_num
“memsize” = var.mem_size
“scsi0.virtualDev” = “lsisas1068”
}
}

build {
sources = [“source.vmware-iso.windows”]

provisioner “powershell” {
scripts = [“setup/setup-winrm.ps1”] # Ensures WinRM is configured
pause_before = “30s”
}

provisioner “powershell” {
scripts = [“setup/setup.ps1”] # General setup script
}

provisioner “powershell” {
scripts = [“setup/vmtools.cmd”] # Installs VMware Tools
}

provisioner “powershell” {
scripts = [“setup/appx.ps1”] # Post-install application setup
}

provisioner “windows-shell” {
inline = [“dir c:\”] # Simple command to test WinRM communication
}
}

that is my script. and my autounattend file is

<?xml version="1.0" encoding="utf-8"?> en-US 0409:00000409 en-US en-US en-US en-US B:\ 250 1 Primary 2 true Primary 1 1 NTFS Boot true 2 2 NTFS System 0 true /IMAGE/INDEX 1 0 2 OnError false true 1 BypassTPMCheck cmd /c reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d 1 2 BypassSecureBootCheck cmd /c reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d 1 3 BypassRAMCheck cmd /c reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d 1 false Central Standard Time false true Remote Desktop all 2 1 true true en-US en-US en-US en-US vagrant true 2 vagrant true %SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f 1 Show file extensions in Explorer %SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f 2 Zero Hibernation File %SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f 3 Disable Hibernation Mode cmd.exe /c wmic useraccount where "name='vagrant'" set PasswordExpires=FALSE 4 Disable password expiration for vagrant user 5 powershell -ExecutionPolicy Bypass -File a:\appx.ps1 Remove AppxPackages true 6 powershell -ExecutionPolicy Bypass -File a:\setup.ps1 Enable WinRM service true false true true true true true Home 1 vagrant true vagrant true administrators vagrant vagrant Vagrant User .

if i get help on how to getout there will much appreciated