We are using ZENworks 2017 Update 2a and I am rewriting the imaging script from Linux to Powershell so we can take advantage of WinPE imaging. I am able to set the following values (blue font) in image safe data then apply the image:
Write-Host "Computer Name: $ZISNAME"
Write-Host ""
$WSNAME = Read-Host -Prompt "Change Name (Enter Name to change,press Enter to keep existing)"
Get-Variable WSNAME -ValueOnly
if ($WSNAME)
Write-Host "Name Changed to $WSNAME"
Write-Host ""
zisedit ScriptedImage=True
zisedit ComputerName=$WSNAME
zisedit dnsHostname=$WSNAME


After the image is copied to the hard drive but before the imaging script exits I check $ZISNAME and the value is set correctly. Without allowing the computer to boot into Windows to run sysprep, I can restart the computer and boot into WinPE maintenance mode and the values for the ComputerName, and dnsHostname are set correctly. So I know the script writes the values and they are stored in image safe data. When the computer boots and sysprep starts, the computer gets a name of USER-XXXXX. This is the same behavior as the Linux imaging environment. However with WinPE, after sysprep completes, the name USER-XXXXX is written to image safe data and that is also the name of the computer. With Liniux, when the computer would reboot after sysprep, it would get the computer name set in image safe data. For example with Lunix, if the name was set to 12345-LT in image safe data then after sysprep the computer name would be 12345-LT. With WinPE the name is USER-XXXXX after sysprep.

Has anyone else had this issue or know how to correct it?