1

Background:

I am attempting to set the host name using a registry key, as I'm deploying a virtual machine and would like to have the host name set based on the guest VM's name. This is the script I'm using to set the host name:

$OSDComputerName = (New-Object -comobject WScript.shell).RegRead("HKLM\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters\VirtualMachineName")
$tsenv = New-Object -ComObject Microsoft.SMS.TSEnvironment
$tsenv.Value("OSDComputerName") ="$OSDComputerName"

The task sequence location:

enter image description here

Problem:

Unfortunately, it fails to set the host name, using instead an autogenerated host name.

Question:

At what point does the registry become established during the task sequence?

Davidw
  • 1,267

0 Answers0