Packer template to build windows image. template has a variablise password for winrm_password, how to fetch it to a userdata.ps1

I am using packer template to build windows image.
template.json fetching dynamic value to a variable.(winrm_password)
in template.json, under builder section providing userdata.ps1 for user_data_file.
Inside the userdata.ps1, how to fetch the variable value from template.json.
(FYI: my userdata.ps1 is to reset administrator password and do winrm configuration)

could anyone suggest on this scenario please. or share a working copy sample for windows image creation in oci.